"use strict";(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([["lazy-react-partial-actions-custom-images-retention-policy","lazy-react-partial-actions-policies","lazy-react-partial-actions-survey","lazy-react-partial-browser-geo-location","lazy-react-partial-codespaces-survey","lazy-react-partial-configure-mcp-server-partial","lazy-react-partial-consent-experience","lazy-react-partial-copilot-assisted-review-upsell","lazy-react-partial-copilot-code-review-feedback","lazy-react-partial-copilot-code-review-upsell","lazy-react-partial-copilot-code-review-view-session","lazy-react-partial-copilot-content-exclusion","lazy-react-partial-copilot-survey","lazy-react-partial-custom-signup-content-manager","lazy-react-partial-date-picker-partial","lazy-react-partial-delete-configuration-dialog","lazy-react-partial-education-schools-auto-complete","lazy-react-partial-email-subscription-form","lazy-react-partial-external-group-team-mismatch-widget","lazy-react-partial-growth-banner-partial","lazy-react-partial-network-configurations-select-panel","lazy-react-partial-new-agent-task-button","lazy-react-partial-react-partial-anchor-example","lazy-react-partial-react-sandbox-sidenav","lazy-react-partial-search-results","lazy-react-partial-security-center-pagination","lazy-react-partial-single-sign-on-dropdown-partial","lazy-react-partial-sponsors-dashboard-your-sponsors","lazy-react-partial-sponsors-newsletters","lazy-react-partial-trade-screening-status-banner","packages_noop_noop_ts-packages_promise-with-resolvers-polyfill_promise-with-resolvers-polyfil-c8aad9"],{6224:(e,t,a)=>{a.d(t,{A:()=>n});let n={container:"UserMessage-module__container--qQMdD",mention:"UserMessage-module__mention--iKJnY",command:"UserMessage-module__command--gs71n"}},6236:(e,t,a)=>{a.d(t,{E:()=>h});var n=a(74848),r=a(77430),i=a(96379),s=a(26607),o=a(94236),l=a(86877),c=a(5524),d=a(96540);let u={ownerDropdownOverlay:"SpacesOwnerDropdown-module__ownerDropdownOverlay--bEFXy",ownerListGroup:"SpacesOwnerDropdown-module__ownerListGroup--U2Z7L",orgLabel:"SpacesOwnerDropdown-module__orgLabel--W_FiN",errorListItem:"SpacesOwnerDropdown-module__errorListItem--eq64y"};var m=a(29731);function h({onSelect:e,repoId:t}){let[a,h]=(0,d.useState)([]),[p,g]=(0,d.useState)(!1),[f,y]=(0,d.useState)(void 0),x=(0,d.useCallback)(t=>{y(t),e(t)},[e]),v=(0,d.useCallback)(()=>{h([]),g(!0)},[]);return(0,d.useEffect)(()=>{(async()=>{try{let e=t?`/github-copilot/chat/custom_copilots_owners?repo_id=${t}`:"/github-copilot/chat/custom_copilots_owners",a=await (0,i.lS)(e),n=await a.json(),r=n?.owners;if(!a.ok||!r)return void v();h(r),r[0]&&x(r[0])}catch{v()}})()},[v,x,t]),(0,n.jsx)("div",{className:"mt-2 mb-1",children:(0,n.jsxs)(l.A,{children:[(0,n.jsx)(l.A.Label,{required:!0,children:"Owner"}),(0,n.jsxs)(o.W,{children:[(()=>{let e=f?.name||"Choose an owner",t=f?(0,n.jsx)(r.r,{src:f.avatarUrl},f.avatarUrl):void 0;return(0,n.jsx)(o.W.Button,{"data-testid":"owner-dropdown-anchor",alignContent:"start","aria-label":e,leadingVisual:t,children:e})})(),(0,n.jsx)(o.W.Overlay,{responsiveVariant:"fullscreen",width:"large",maxHeight:"large",className:u.ownerDropdownOverlay,children:(0,n.jsx)(c.l,{children:(0,n.jsx)(c.l.Group,{className:u.ownerListGroup,children:(0,n.jsxs)(c.l,{selectionVariant:"single",children:[a&&a.map(e=>{let{name:t,avatarUrl:a,displayName:i}=e;return(0,n.jsxs)(c.l.Item,{selected:t===f?.name,onSelect:()=>x(e),children:[(0,n.jsx)(c.l.LeadingVisual,{children:(0,n.jsx)(r.r,{src:a})}),t,(0,n.jsx)(c.l.Description,{children:i})]},t)}),!a.length&&!p&&(0,n.jsx)(c.l.Item,{disabled:!0,children:"Fetching owners\u2026"},"fetching-owners"),p&&(0,n.jsx)(c.l.Item,{disabled:!0,className:u.errorListItem,children:"An error occurred while loading owners. Please reopen the dialog to try again."},"error-fetching-owners")]})})})})]}),(0,n.jsx)(l.A.Caption,{children:f?"User"===f.type?(0,n.jsxs)("div",{className:"mt-2 d-flex flex-row flex-shrink flex-items-center",children:[(0,n.jsx)(s.A,{className:"mr-1",children:"Private"}),(0,n.jsx)("span",{...(0,m.G)("owner-user-caption"),children:"Only you will be able to see this space."})]}):(0,n.jsxs)("div",{className:"mt-2 d-flex flex-row flex-shrink",children:[(0,n.jsx)(s.A,{className:u.orgLabel,children:"Private"}),(0,n.jsx)("span",{...(0,m.G)("owner-org-caption"),children:"Only visible to you and organization admins. You can share it later."})]}):"Where we will store your space."})]})})}try{h.displayName||(h.displayName="SpacesOwnerDropdown")}catch{}},7730:(e,t,a)=>{a.d(t,{g:()=>i});var n=a(21728),r=a(96540);function i(e){let t,a=(0,n.c)(2),[i,s]=(0,r.useState)(!1);return a[0]!==e?(t=()=>{let t=e.current,a=t?.lastElementChild;if(!a)return;let n=new IntersectionObserver(e=>{let[t]=e;return s(t?.isIntersecting??!0)},{root:t,threshold:1});return n.observe(a),()=>n.disconnect()},a[0]=e,a[1]=t):t=a[1],(0,r.useEffect)(t),i}},13171:(e,t,a)=>{a.d(t,{r:()=>eq});var n,r=a(74848),i=a(21728),s=a(25407),o=a(71315),l=a(38621),c=a(19579),d=a(69726),u=a(21373),m=a(77430),h=a(81960),p=a(46251),g=a(26607);let f={"contacts-container":"Contact-module__contacts-container--ggMhC","contact-list":"Contact-module__contact-list--NoW0r","contact-container":"Contact-module__contact-container--DsJZr","contact-info-container":"Contact-module__contact-info-container--sz7D3"},y={monogram:"Monogram-module__monogram--MgMG7"},x=e=>{let t,a=(0,i.c)(2),{initials:n}=e;return a[0]!==n?(t=(0,r.jsx)("div",{className:y.monogram,children:n}),a[0]=n,a[1]=t):t=a[1],t};try{x.displayName||(x.displayName="Monogram")}catch{}let v=e=>{let t,a,n,s,o,l=(0,i.c)(14),{size:c,information:d}=e,u=void 0===c?48:c;return l[0]!==d.avatar_url||l[1]!==d.username||l[2]!==u?(t=d.avatar_url?(0,r.jsx)(m.r,{square:!0,size:u,src:d.avatar_url,alt:d.username||"User avatar"}):(0,r.jsx)(x,{initials:d.username.charAt(0)}),l[0]=d.avatar_url,l[1]=d.username,l[2]=u,l[3]=t):t=l[3],l[4]!==d.username?(a=(0,r.jsx)(h.A,{as:"h2",variant:"small",children:d.username}),l[4]=d.username,l[5]=a):a=l[5],l[6]!==d.rank?(n=(0,r.jsx)(p.B,{direction:"horizontal",wrap:"wrap",children:(0,r.jsx)(g.A,{children:d.rank},d.rank)}),l[6]=d.rank,l[7]=n):n=l[7],l[8]!==a||l[9]!==n?(s=(0,r.jsxs)("div",{className:f["contact-info-container"],children:[a,n]}),l[8]=a,l[9]=n,l[10]=s):s=l[10],l[11]!==t||l[12]!==s?(o=(0,r.jsxs)("div",{className:f["contact-container"],children:[t,s]}),l[11]=t,l[12]=s,l[13]=o):o=l[13],o},C=e=>{let t,a,n,s=(0,i.c)(5),{contacts:o}=e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(h.A,{as:"h1",variant:"medium",children:"Who to talk to"}),s[0]=t):t=s[0],s[1]!==o?(a=o?.map(_),s[1]=o,s[2]=a):a=s[2],s[3]!==a?(n=(0,r.jsxs)("div",{className:f["contacts-container"],children:[t,(0,r.jsx)("div",{className:f["contact-list"],children:a})]}),s[3]=a,s[4]=n):n=s[4],n};try{v.displayName||(v.displayName="Contact")}catch{}try{C.displayName||(C.displayName="ContactList")}catch{}function _(e){return(0,r.jsx)(v,{information:e},e.id)}let S={"spinner-container":"CopilotMetadata-module__spinner-container--EidxZ","tab-container":"CopilotMetadata-module__tab-container--qijcK",muted:"CopilotMetadata-module__muted--B9Loh","metadata-container":"CopilotMetadata-module__metadata-container--C3sG4","referrer-button":"CopilotMetadata-module__referrer-button--DOYxm"};var b=a(65411),j=a(96379),w=a(96540);let N=e=>{let t,a,n,m,h,p,g,f,y,x,v,_,N,I,E,T=(0,i.c)(44),{currentTab:A,setCurrentTab:R,loading:k,setLoading:L,makeCAPIRequest:P,fileContext:M}=e,O=void 0===k||k,D=M?.repoOwner,F=M?.repoName;T[0]===Symbol.for("react.memo_cache_sentinel")?(t=new URLSearchParams(o.cg?.location.search).get("issue")||"",T[0]=t):t=T[0];let B=t;T[1]!==D||T[2]!==F?(a=D&&F&&B?(0,s.dRG)({owner:D,repo:F,issueNumber:Number(B)}):void 0,T[1]=D,T[2]=F,T[3]=a):a=T[3];let $=a;T[4]!==M||T[5]!==P||T[6]!==L?(n={fileContext:M,setLoading:L,issueNumber:B,makeCAPIRequest:P},T[4]=M,T[5]=P,T[6]=L,T[7]=n):n=T[7];let{collaborators:z}=(({setLoading:e,issueNumber:t,makeCAPIRequest:a,fileContext:n})=>{let[r,i]=(0,w.useState)([]),{repoOwner:s,repoName:o,ref:l,path:c}=n??{},d=(0,w.useCallback)(async()=>{try{if(!n)return"";let e=await (0,j.lS)(`/${s}/${o}/collaborator_prompt/${c}?ref=${l}${t?`&issue=${t}`:""}`);if(!e.ok)throw Error("Something went wrong");let r=await e.text(),i={messages:[{role:"user",content:r}],model:"gpt-4o-mini",stream:!1,response_format:{type:"json_schema",json_schema:{name:"Collaborators",description:"List of metadata objects for the top collaborators",strict:!0,schema:{type:"object",additionalProperties:!1,properties:{collaborators:{type:"array",items:{type:"object",additionalProperties:!1,properties:{id:{type:"integer",description:"The collaborator's GitHub user ID."},username:{type:"string",description:"The collaborator's GitHub handle."},avatar_url:{type:"string",description:"The URL of the collaborator's GitHub user avatar."},rank:{type:"string",description:"The rank assignment of the collaborator."},explanation:{type:"string",description:"A brief 1-2 sentence description of the rank assignment."}},required:["id","username","avatar_url","rank","explanation"]}}},required:["collaborators"]}},temperature:0}},d=new b.J([]),u=await d.getAuthToken(),m=await a({basePath:"https://api.githubcopilot.com",body:i,path:"/chat/completions",method:"POST",streamingResponse:!1,authToken:u,integrationId:"copilot-directory"});if(!m.ok)throw Error("Something went wrong");let h=await m.json();return h.choices[0]?.message?.content}catch{throw Error("Something went wrong")}},[]);return(0,w.useEffect)(()=>{r?.length||d().then(t=>{e(!1),i(JSON.parse(t)?.collaborators)},()=>{e(!1)})},[]),{collaborators:r,getCollaborators:d}})(n);T[8]!==$?(m=()=>{$&&(window.location.href=$)},T[8]=$,T[9]=m):m=T[9];let U=m,W="chat"===A?"page":void 0;T[10]!==R?(h=()=>R("chat"),T[10]=R,T[11]=h):h=T[11],T[12]!==W||T[13]!==h?(p=(0,r.jsx)(c.O.Item,{"aria-current":W,onSelect:h,children:"Chat"}),T[12]=W,T[13]=h,T[14]=p):p=T[14];let V="directory"===A?"page":void 0;T[15]!==z?.length||T[16]!==O||T[17]!==R?(g=()=>{!O&&z?.length&&R("directory")},T[15]=z?.length,T[16]=O,T[17]=R,T[18]=g):g=T[18],T[19]!==z?.length?(f=z?.length?{}:{className:S.muted},T[19]=z?.length,T[20]=f):f=T[20];let H=z?.length||O?"Directory":"Directory unavailable";return T[21]!==f||T[22]!==H?(y=(0,r.jsx)("span",{...f,children:H}),T[21]=f,T[22]=H,T[23]=y):y=T[23],T[24]!==O?(x=O&&(0,r.jsx)("div",{className:S["spinner-container"],children:(0,r.jsx)(d.A,{size:"small"})}),T[24]=O,T[25]=x):x=T[25],T[26]!==y||T[27]!==x?(v=(0,r.jsxs)("div",{className:S["tab-container"],children:[y,x]}),T[26]=y,T[27]=x,T[28]=v):v=T[28],T[29]!==g||T[30]!==v||T[31]!==V?(_=(0,r.jsx)(c.O.Item,{"aria-current":V,onSelect:g,children:v}),T[29]=g,T[30]=v,T[31]=V,T[32]=_):_=T[32],T[33]!==_||T[34]!==p?(N=(0,r.jsxs)(c.O,{"aria-label":"Repository",children:[p,_]}),T[33]=_,T[34]=p,T[35]=N):N=T[35],T[36]!==z||T[37]!==A||T[38]!==$||T[39]!==U?(I="directory"===A&&(0,r.jsxs)("div",{className:S["metadata-container"],children:[(0,r.jsx)("div",{children:(0,r.jsx)(C,{contacts:z})}),$&&(0,r.jsx)("div",{className:S["referrer-button"],children:(0,r.jsx)(u.Q,{variant:"link",leadingVisual:l.ArrowLeftIcon,onClick:U,children:`Return to Issue${B?` ${B}`:""}`})})]}),T[36]=z,T[37]=A,T[38]=$,T[39]=U,T[40]=I):I=T[40],T[41]!==N||T[42]!==I?(E=(0,r.jsxs)("div",{children:[N,I]}),T[41]=N,T[42]=I,T[43]=E):E=T[43],E};try{N.displayName||(N.displayName="CopilotMetadata")}catch{}var I=a(69599),E=a(53627),T=a(53419),A=a(88431),R=a(10095),k=a(87448),L=a(34164),P=a(87419),M=a(88392),O=a(25641),D=a(73952),F=a(51213),B=a(35247),$=a(2635),z=a(33592),U=a(72303),W=a(46062),V=a(68637),H=a(97315);let q={legalText:"Chat-module__legalText--nFibb",ChatMainContainer:"Chat-module__ChatMainContainer--r_Lbb",messagesContainer:"Chat-module__messagesContainer--pUaGC",loadingStateContainer:"Chat-module__loadingStateContainer--jXyyu",loadingText:"Chat-module__loadingText--XRJo1",errorContainer:"Chat-module__errorContainer--Ci2Ci",suggestedPromptsGrid:"Chat-module__suggestedPromptsGrid--DPria",chatInputContainer:"Chat-module__chatInputContainer--yKT4X",suggestedPromptButton:"Chat-module__suggestedPromptButton--VrQUl",promptHeading:"Chat-module__promptHeading--CccY2",promptDescription:"Chat-module__promptDescription--gkjS8"};var K=a(70257),G=a(30558),Q=a(63262),Z=a(7104),J=a(32744),Y=a(5524);let X={suggestionListHeading:"CopilotSuggestions-module__suggestionListHeading--W7rpU",suggestionItem:"CopilotSuggestions-module__suggestionItem--hVOB9",suggestionsList:"CopilotSuggestions-module__suggestionsList--vzbN1"},ee=e=>{let t,a,n,s=(0,i.c)(10),{suggestionKind:o}=e,c=(0,$.Pk)(),d=(0,z.b)();s[0]!==d||s[1]!==c?(t=e=>{d.sendChatMessage({thread:(0,U.W)(c),content:e.prompt??e.question,intent:e.intent,modeOverride:e.mode,references:c.currentReferences,topic:c.currentTopic,context:c.context}),(0,T.BI)("copilot_generated_suggestion_click",{intent:e.intent,mode:e.mode,contextType:c.context?.[0]?.type,content:e.question})},s[0]=d,s[1]=c,s[2]=t):t=s[2];let u=t;s[3]!==u?(a=(0,w.memo)(function(e){let{suggestion:t}=e;return(0,r.jsxs)(Y.l.Item,{onSelect:()=>u(t),className:X.suggestionItem,children:[(0,r.jsx)(Y.l.LeadingVisual,{children:(0,r.jsx)(R.A,{icon:l.PaperAirplaneIcon})}),(0,r.jsxs)("span",{children:[" ",t.question]})]})}),s[3]=u,s[4]=a):a=s[4];let m=a,h="loading"===c.messagesLoading.state||!!c.streamingMessage,{suggestions:p}=c,g=c.currentReferences[0],f=1===c.currentReferences.length&&g?.type==="repository"&&g.id===c.currentRepository?.id,y=!!(!h&&f);return s[5]!==m||s[6]!==y||s[7]!==o||s[8]!==p?(n=y&&p&&p.suggestions?(0,r.jsxs)(Y.l,{className:(0,L.$)("copilot-suggestions",X.suggestionsList),children:["initial"===o&&(0,r.jsx)(Y.l.Heading,{as:"h2",className:X.suggestionListHeading,children:function(e){return e?`Ask about the ${e.replace(/-/g," ")}:`:"Ask anything:"}(p.referenceType)}),p?.suggestions.map(e=>(0,r.jsx)(m,{suggestion:e},e.question))]}):null,s[5]=m,s[6]=y,s[7]=o,s[8]=p,s[9]=n):n=s[9],n},et=(0,w.memo)(ee);try{ee.displayName||(ee.displayName="CopilotSuggestions")}catch{}try{(n=CopilotSuggestion).displayName||(n.displayName="CopilotSuggestion")}catch{}var ea=a(93412),en=a(35673),er=a(79184),ei=a(74753),es=a(73077),eo=a(26108);let el={container:"CustomBanner-module__container--QLdBn",expanded:"CustomBanner-module__expanded--NUbF0",actions:"CustomBanner-module__actions--zeIqy",iconButton:"CustomBanner-module__iconButton--BUeu0",content:"CustomBanner-module__content--szVMr",icon:"CustomBanner-module__icon--_7NPB"};function ec(e){let t,a,n,s,o,c,d,u=(0,i.c)(16),{icon:m,content:h,actions:p,onDismiss:g}=e,f=(0,w.useRef)(null),[y,x]=(0,w.useState)(!1);u[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{let e=f.current;if(!e)return;let t=new ResizeObserver(t=>{for(let a of t)a.target===e&&(a.contentRect.height>40?x(!0):x(!1))});return t.observe(e),()=>{t.disconnect()}},a=[],u[0]=t,u[1]=a):(t=u[0],a=u[1]),(0,w.useEffect)(t,a);let v=`${el.container} ${y?el.expanded:""}`;return u[2]!==m?(n=(0,r.jsx)("div",{className:el.icon,children:m}),u[2]=m,u[3]=n):n=u[3],u[4]!==h?(s=(0,r.jsx)("div",{className:el.content,children:h}),u[4]=h,u[5]=s):s=u[5],u[6]!==g?(o=g&&(0,r.jsx)(eo.K,{className:el.iconButton,variant:"invisible",icon:l.XIcon,size:"medium","aria-label":"Close",onClick:g}),u[6]=g,u[7]=o):o=u[7],u[8]!==p||u[9]!==o?(c=(0,r.jsxs)("div",{className:el.actions,children:[p,o]}),u[8]=p,u[9]=o,u[10]=c):c=u[10],u[11]!==v||u[12]!==n||u[13]!==s||u[14]!==c?(d=(0,r.jsxs)("div",{ref:f,className:v,children:[n,s,c]}),u[11]=v,u[12]=n,u[13]=s,u[14]=c,u[15]=d):d=u[15],d}try{ec.displayName||(ec.displayName="CustomBanner")}catch{}function ed(){let e,t,a,n,s,o=(0,i.c)(7),{resetDate:c}=(0,er.xR)();o[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(l.InfoIcon,{}),o[0]=e):e=o[0];let d=e;o[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(ei.s,{children:(0,r.jsx)("h2",{children:"Usage limit reached"})}),o[1]=t):t=o[1],o[2]!==c?(a=(0,r.jsxs)(r.Fragment,{children:[t,"You have reached your free plan limit. It will reset on ",c]}),o[2]=c,o[3]=a):a=o[3];let u=a;o[4]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)(es.z,{as:"a",href:"https://github.com/features/copilot#pricing",onClick:eu,children:"Upgrade"}),o[4]=n):n=o[4];let m=n;return o[5]!==u?(s=(0,r.jsx)(ec,{icon:d,content:u,actions:m}),o[5]=u,o[6]=s):s=o[6],s}function eu(){(0,T.BI)("dotcom_chat.activate",{target:"QUOTA_EXCEEDED_BANNER_LINK_UPGRADE",mode:"assistive"})}try{ed.displayName||(ed.displayName="QuotaExceededBanner")}catch{}var em=a(74807),eh=a(57352);let ep={container:"QuotaExceededEmptyState-module__container--UBt9E",main:"QuotaExceededEmptyState-module__main--rwRZl",copy:"QuotaExceededEmptyState-module__copy--Ul81N",heading:"QuotaExceededEmptyState-module__heading--jMYRX",description:"QuotaExceededEmptyState-module__description--SvMpU",footer:"QuotaExceededEmptyState-module__footer--lM9PT"};function eg(){let e,t,a,n,s,o,l,c,d,u,m,h,p=(0,i.c)(19),{resetDate:g}=(0,er.xR)(),[f,y]=(0,w.useState)(!1),[x,v]=(0,w.useState)(!1);p[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{y(!0),v(!0)},p[0]=e):e=p[0];let C=e;p[1]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{y(!1)},p[1]=t):t=p[1];let _=t;p[2]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{v(!1)},p[2]=a):a=p[2];let S=a,b=f||x;return p[3]!==f||p[4]!==b?(n=b?(0,r.jsx)(em.N,{animationType:"jumpWiggle",loopAnimation:f,size:80,onAnimationEnd:S}):(0,r.jsx)(em.N,{animationType:"static",loopAnimation:!1,size:80}),p[3]=f,p[4]=b,p[5]=n):n=p[5],p[6]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)("h2",{className:ep.heading,children:"You\u2019ve reached your free plan limit"}),p[6]=s):s=p[6],p[7]!==g?(o=(0,r.jsxs)("p",{className:ep.description,children:["Your limits will reset on ",g,"."]}),p[7]=g,p[8]=o):o=p[8],p[9]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)(es.z,{as:"a",variant:"primary",href:"https://github.com/github-copilot/pro",onMouseEnter:C,onMouseLeave:_,onClick:ef,children:"Upgrade"}),p[9]=l):l=p[9],p[10]!==o?(c=(0,r.jsxs)("div",{className:ep.copy,children:[s,o,l]}),p[10]=o,p[11]=c):c=p[11],p[12]!==n||p[13]!==c?(d=(0,r.jsxs)("div",{className:ep.main,children:[n,c]}),p[12]=n,p[13]=c,p[14]=d):d=p[14],p[15]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsx)("strong",{children:"Part of an organization?"}),p[15]=u):u=p[15],p[16]===Symbol.for("react.memo_cache_sentinel")?(m=(0,r.jsxs)("div",{className:ep.footer,children:[u,(0,r.jsxs)("span",{children:["Upgrade to"," ",(0,r.jsx)(eh.A,{href:"https://github.com/github-copilot/business_signup/choose_business_type?cft=copilot_li.features_copilot.cfb",inline:!0,children:"Copilot Business"})," ","to enable across teams."]})]}),p[16]=m):m=p[16],p[17]!==d?(h=(0,r.jsxs)("div",{className:ep.container,children:[d,m]}),p[17]=d,p[18]=h):h=p[18],h}function ef(){(0,T.BI)("dotcom_chat.activate",{target:"QUOTA_EXCEEDED_EMPTY_STATE_LINK_UPGRADE",mode:"assistive"})}try{eg.displayName||(eg.displayName="QuotaExceededEmptyState")}catch{}var ey=a(79064);let ex={container:"QuotaMeterBanner-module__container--BWRlc"};function ev(){let e,t,a,n,s,o,c,d=(0,i.c)(9),{isLicensedLimited:u,chatQuotaRemaining:m}=(0,er.xR)(),[h,p]=(0,w.useState)(e_);d[0]!==m||d[1]!==u?(e=()=>{if(u&&void 0!==m){let e=ey.Jt.getMeterBannerFlag();m>0&&m<=10?null===e?(ey.Jt.setMeterBannerFlag(!0),p(!0)):p(e):(ey.Jt.removeMeterBannerFlag(),p(!1))}},t=[u,m],d[0]=m,d[1]=u,d[2]=e,d[3]=t):(e=d[2],t=d[3]),(0,w.useEffect)(e,t),d[4]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{ey.Jt.setMeterBannerFlag(!1),p(!1)},d[4]=a):a=d[4];let g=a;if(!h||void 0===m)return null;d[5]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)(l.InfoIcon,{}),d[5]=n):n=d[5];let f=n;d[6]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ei.s,{children:(0,r.jsx)("h2",{children:"Usage limit approaching"})}),"You only have a few free responses remaining."]}),d[6]=s):s=d[6];let y=s;d[7]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(es.z,{as:"a",href:"https://github.com/features/copilot#pricing",onClick:eC,children:"Upgrade"}),d[7]=o):o=d[7];let x=o;return d[8]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)("div",{className:ex.container,children:(0,r.jsx)(ec,{icon:f,content:y,actions:x,onDismiss:g})}),d[8]=c):c=d[8],c}function eC(){(0,T.BI)("dotcom_chat.activate",{target:"QUOTA_METER_BANNER_LINK_UPGRADE",mode:"assistive"})}function e_(){return ey.Jt.getMeterBannerFlag()??!1}try{ev.displayName||(ev.displayName="QuotaMeterBanner")}catch{}var eS=a(33544);let eb={iconContainer:"ChatWithCopilotHeader-module__iconContainer--XyD0H",headerTitle:"ChatWithCopilotHeader-module__headerTitle--ovUdi",descriptionText:"ChatWithCopilotHeader-module__descriptionText--bb_1f"};var ej=a(78328);function ew(e){let t,a,n,s=(0,i.c)(4),{mode:o}=e;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("div",{className:eb.iconContainer,children:(0,r.jsx)(ej.A,{})}),a=(0,r.jsx)(h.A,{as:"h1",className:eb.headerTitle,children:"Ask Copilot"}),s[0]=t,s[1]=a):(t=s[0],a=s[1]);let l="immersive"===o?5:3;return s[2]!==l?(n=(0,r.jsxs)(r.Fragment,{children:[t,a,(0,r.jsx)(k.EY,{as:"p",sx:{mb:l},className:eb.descriptionText,children:"Select a repository to get started. Ask questions about your codebase to get answers fast and learn your way around."})]}),s[2]=l,s[3]=n):n=s[3],n}try{ew.displayName||(ew.displayName="ChatWithCopilotHeader")}catch{}function eN(e){let t,a=(0,i.c)(4),{docset:n,size:s}=e,o="organization"===n.ownerType;return a[0]!==n.avatarUrl||a[1]!==s||a[2]!==o?(t=(0,r.jsx)(m.r,{src:n.avatarUrl,square:o,size:s}),a[0]=n.avatarUrl,a[1]=s,a[2]=o,a[3]=t):t=a[3],t}try{eN.displayName||(eN.displayName="KnowledgeBaseAvatar")}catch{}var eI=a(70170),eE=a(99511),eT=a(26408),eA=a(26239),eR=a(27844);let ek={TopicListContainer:"TopicList-module__TopicListContainer--q95Ja",searchInputContainer:"TopicList-module__searchInputContainer--MpQGB",TextInput:"TopicList-module__TextInput--tm_7r",loadingContainer:"TopicList-module__loadingContainer--gQUvo",mutedLeadingVisual:"TopicList-module__mutedLeadingVisual--zyTv5",ActionList_Divider:"TopicList-module__ActionList_Divider--tKVd_",generalPurposeItem:"TopicList-module__generalPurposeItem--UKLE6"};function eL(){let e,t,a,n,s,o,c,u,m,h,p,g=(0,i.c)(23),f=(0,z.b)(),{mode:y,selectedThreadID:x}=(0,$.Pk)(),[v,C]=(0,w.useState)("");g[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,eI.s)(e=>C(e),400,{start:!1}),g[0]=e):e=g[0];let _=e,{repositories:S,loading:b,resetTopRepoResults:j}=(0,eT.U)(v,!0,4);g[1]!==f||g[2]!==y||g[3]!==j||g[4]!==x?(t=async e=>{if(j(),void 0===e){f.showTopicPicker(!1),f.clearCurrentTopic(),f.clearCurrentReferences(),"immersive"===y&&(0,E.kd)("/copilot"),x&&ey.Jt.setSelectedTopic(x,null);return}await f.fetchCurrentRepo(Number(e)),f.showTopicPicker(!1)},g[1]=f,g[2]=y,g[3]=j,g[4]=x,g[5]=t):t=g[5];let N=t;e:{if(b){a="Loading repositories";break e}if(0===S.length){a="No repositories found";break e}if(1===S.length){a="1 repository found";break e}a=`${S.length} repositories found`}let I=a;return g[6]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)("div",{className:ek.searchInputContainer,children:(0,r.jsx)(eE.A,{id:eA.uN,leadingVisual:l.SearchIcon,name:"topic-search","aria-label":"Search repositories to chat about",placeholder:"Search repositories to chat about",onChange:e=>_(e.target.value),className:ek.TextInput})}),g[6]=n):n=g[6],g[7]!==I?(s=(0,r.jsx)("div",{role:"status",className:"sr-only",children:I}),g[7]=I,g[8]=s):s=g[8],g[9]!==N||g[10]!==b||g[11]!==S?(o=b?(0,r.jsx)("li",{className:ek.loadingContainer,children:(0,r.jsx)(d.A,{})}):0===S.length?(0,r.jsxs)(Y.l.Item,{disabled:!0,children:[(0,r.jsx)(Y.l.LeadingVisual,{className:ek.mutedLeadingVisual,children:(0,r.jsx)(l.CircleSlashIcon,{})}),(0,r.jsx)("span",{className:ek.mutedLeadingVisual,children:"No results found"})]}):(0,r.jsx)(r.Fragment,{children:S.length>0&&(0,r.jsxs)(Y.l.Group,{children:[(0,r.jsx)(Y.l.GroupHeading,{as:"h3",children:"Recent repositories"}),S.map(e=>(0,r.jsx)(eR.W,{repo:e,onSelect:N,trailingVisualComponent:(0,r.jsx)(l.ArrowRightIcon,{})},e.nwo))]})}),g[9]=N,g[10]=b,g[11]=S,g[12]=o):o=g[12],g[13]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)(Y.l.Divider,{className:ek.ActionList_Divider}),g[13]=c):c=g[13],g[14]!==N?(u=()=>N(void 0),g[14]=N,g[15]=u):u=g[15],g[16]===Symbol.for("react.memo_cache_sentinel")?(m=(0,r.jsx)(Y.l.TrailingVisual,{children:(0,r.jsx)(l.ArrowRightIcon,{})}),g[16]=m):m=g[16],g[17]!==u?(h=(0,r.jsxs)(Y.l.Item,{id:"chat-with-no-context",onSelect:u,className:ek.generalPurposeItem,children:["General purpose chat",m]},"chat-with-no-context"),g[17]=u,g[18]=h):h=g[18],g[19]!==s||g[20]!==o||g[21]!==h?(p=(0,r.jsxs)("div",{className:ek.TopicListContainer,children:[n,(0,r.jsxs)(Y.l,{children:[s,o,c,h]})]}),g[19]=s,g[20]=o,g[21]=h,g[22]=p):p=g[22],p}try{eL.displayName||(eL.displayName="TopicList")}catch{}let eP={TopicPickerContainer:"TopicPicker-module__TopicPickerContainer--jqRrB",mainContentContainer:"TopicPicker-module__mainContentContainer--EAEDK",topicListContainer:"TopicPicker-module__topicListContainer--q3K2a",SingleSignOnBanner:"TopicPicker-module__SingleSignOnBanner--WOn5V",topicDescriptionContainer:"TopicPicker-module__topicDescriptionContainer--CGD3V",docsetDescriptionCard:"TopicPicker-module__docsetDescriptionCard--IYOzX",docsetHeaderContainer:"TopicPicker-module__docsetHeaderContainer--E0Vtq",Heading:"TopicPicker-module__Heading--m61pA",statusText:"TopicPicker-module__statusText--EdXY0",repositoriesSubheading:"TopicPicker-module__repositoriesSubheading--ihIfq",repositoriesContainer:"TopicPicker-module__repositoriesContainer--x7mXz",repositoryItem:"TopicPicker-module__repositoryItem--hnv1a"},eM=()=>{let e,t,a,n,s,o,l=(0,i.c)(14),c=(0,$.Pk)();e:{let t;if(!c.ssoOrganizations){let t;l[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],l[0]=t):t=l[0],e=t;break e}l[1]!==c.ssoOrganizations?(t=c.ssoOrganizations.map(eB),l[1]=c.ssoOrganizations,l[2]=t):t=l[2],e=t}let d=e;return l[3]!==c.mode?(t=(0,r.jsx)(ew,{mode:c.mode}),l[3]=c.mode,l[4]=t):t=l[4],l[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)("div",{className:eP.topicListContainer,children:(0,r.jsx)(eL,{})}),l[5]=a):a=l[5],l[6]!==d?(n=!(0,I.G7)("global_sso_banner")&&(0,r.jsx)(eS.x,{portalContainerName:en.E5,protectedOrgs:d,redirectURI:e$,className:eP.SingleSignOnBanner}),l[6]=d,l[7]=n):n=l[7],l[8]!==c.currentTopic?(s=(0,r.jsx)(eO,{currentTopic:c.currentTopic}),l[8]=c.currentTopic,l[9]=s):s=l[9],l[10]!==t||l[11]!==n||l[12]!==s?(o=(0,r.jsx)("div",{className:eP.TopicPickerContainer,children:(0,r.jsxs)("div",{className:eP.mainContentContainer,children:[t,a,n,s]})}),l[10]=t,l[11]=n,l[12]=s,l[13]=o):o=l[13],o};function eO(e){let t,a=(0,i.c)(2),{currentTopic:n}=e;return(0,O.P)(n)?(a[0]!==n?(t=(0,r.jsx)("div",{className:eP.topicDescriptionContainer,children:(0,r.jsx)(eD,{docset:n})}),a[0]=n,a[1]=t):t=a[1],t):null}function eD(e){let t,a,n,s,o,l,c,d,u=(0,i.c)(16),{docset:m}=e;return u[0]!==m?(t=(0,r.jsx)(eN,{docset:m,size:24}),u[0]=m,u[1]=t):t=u[1],u[2]!==m.name?(a=(0,r.jsx)(h.A,{as:"h3",className:eP.Heading,children:m.name}),u[2]=m.name,u[3]=a):a=u[3],u[4]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)("span",{className:eP.statusText,children:"Knowledge base added to conversation"}),u[4]=n):n=u[4],u[5]!==t||u[6]!==a?(s=(0,r.jsxs)("div",{className:eP.docsetHeaderContainer,children:[t,a," ",n]}),u[5]=t,u[6]=a,u[7]=s):s=u[7],u[8]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(h.A,{as:"h4",className:eP.repositoriesSubheading,children:"Repositories in this knowledge base"}),u[8]=o):o=u[8],u[9]!==m.repos?(l=m.repos.map(eF),u[9]=m.repos,u[10]=l):l=u[10],u[11]!==l?(c=(0,r.jsx)("div",{className:eP.repositoriesContainer,children:l}),u[11]=l,u[12]=c):c=u[12],u[13]!==s||u[14]!==c?(d=(0,r.jsxs)("div",{className:eP.docsetDescriptionCard,children:[s,o,c]}),u[13]=s,u[14]=c,u[15]=d):d=u[15],d}function eF(e){return(0,r.jsxs)("div",{className:eP.repositoryItem,children:[(0,r.jsx)(l.RepoIcon,{}),` ${e}`]},e)}try{eM.displayName||(eM.displayName="TopicPicker")}catch{}try{eO.displayName||(eO.displayName="TopicDescription")}catch{}try{eD.displayName||(eD.displayName="DocsetDescription")}catch{}function eB(e){return e.login}function e$(){return`/search/refresh_blackbird_caches?return_to=${location.href}`}let ez=({disableTopicPicker:e,inputRef:t,showQuotaExceededEmptyState:a})=>{let n=(0,$.Pk)(),{isWaitingOnCopilot:i,showTopicPicker:s,streamingMessage:o}=n,{scrollToBottom:l}=(0,Z.b)(),{messages:c,groupedMessages:d}=(0,M.a)(n);return(0,A.N)(()=>l("instant"),[l]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h2",{className:"sr-only",children:"Copilot Chat"}),a?(0,r.jsx)(eg,{}):s&&!e?(0,r.jsx)(eM,{}):(0,r.jsx)("div",{className:q.ChatMainContainer,children:(0,r.jsxs)("div",{className:(0,L.$)("copilot-messages-container",q.messagesContainer),children:[0===c.length&&(0,r.jsx)("p",{className:q.legalText,children:(0,r.jsx)(ea.h,{})}),d.map((e,a)=>(0,r.jsx)(Q.i,{isLastGroup:a===d.length-1,children:e.map((s,l)=>{let u=a===d.length-1&&l===e.length-1;return(s===o||s.id===F.Wp||!eU(s)||!B.W.dotcomChatClientSideSkills||s.error||eW(s,u,n))&&(0,r.jsx)(G.c,{isLatestMessage:u,isFirstReply:1===c.length,isStreaming:s.id===o?.id||u&&i,message:s,inputRef:t},l)})},a)),n.clientSkillConfirmation&&B.W.dotcomChatClientSideSkills&&(0,r.jsx)("div",{className:"m-3",children:(0,r.jsx)(J.m,{confirmation:n.clientSkillConfirmation,handleConfirmation:e=>n.clientSkillConfirmation?.onSubmit?.("accepted"===e.state),isLatestMessage:!0})})]})})]})},eU=e=>!e.content&&(!e.confirmations||0===e.confirmations.length)&&(!e.clientConfirmations||0===e.clientConfirmations.length),eW=(e,t,a)=>(e=>e.clientSkillsRequests&&e.clientSkillsRequests.length>0||e.clientToolResults&&e.clientToolResults.length>0)(e)&&t&&!a.streamingMessage&&!a.clientSkillConfirmation,eV=()=>(0,r.jsxs)("div",{className:q.loadingStateContainer,children:[(0,r.jsx)(d.A,{size:"large"}),(0,r.jsx)("div",{className:q.loadingText,children:"Loading conversation\u2026"})]}),eH=()=>{let{mode:e,reviewLab:t}=(0,$.Pk)();return(0,r.jsxs)(k.az,{sx:{pl:"immersive"===e?3:2},className:q.errorContainer,children:[(0,r.jsx)(R.A,{icon:l.AlertIcon}),"Failed to load previous messages.",t&&(0,r.jsx)(r.Fragment,{children:"\xa0You are in a review lab. Please check that you are connected to the Developer VPN."})]})},eq=({inputRef:e})=>{let t=(0,$.Pk)(),a=(0,z.b)(),{currentReferences:n,messagesLoading:i,messagesRestored:s,threadsLoading:o,currentTopic:c,messages:d,mode:u,selectedThreadID:m,showTopicPicker:h,context:p}=t,g=(0,U.W)(t),f=(0,w.useMemo)(()=>(0,O.k4)(Object.keys(V.Pe)).slice(0,4).map(e=>({heading:e,content:(0,O.k4)(V.Pe[e])[0]})),[]),{textAreaRef:y}=(0,P.Y)(e),{chatQuotaExceeded:x,isLicensedLimited:v,reloadQuota:C}=(0,er.xR)(),{ambientError:_}=(0,$.Pk)(),[S,b]=(0,w.useState)(!0),[j,A]=(0,w.useState)("chat"),R=(0,I.G7)("copilot_metadata_poc"),k=!!p&&p[0]&&("file"===p[0].type||"file-v2"===p[0].type),M=(0,W.GF)(t.availableModels);(0,w.useEffect)(()=>{if(!m||"assistive"===u)return;let e=`${O.Jz}/c/${m}`;window.location.pathname!==e&&0!==d.length&&(0,E.kd)(e)},[m,u,d.length]);let F=(0,w.useCallback)(async(e,r)=>{if(""===e.trim())return;C("user_submit");let i=[...n,...r||[]];await a.sendChatMessage({thread:g,content:e,references:i,topic:c,context:p,customInstructions:t.customInstructions,skillOptions:t.skillOptions,model:M})},[C,a,g,n,c,p,t.customInstructions,t.skillOptions,M]),B=s&&d.length>0,G="loading"===i.state&&t.selectedThreadID&&!h&&!B,Q="error"===i.state||"error"===o.state,J="loaded"===i.state||B,Y=x&&(h||!g),[X]=(0,w.useState)(t.renderAttachKnowledgeBaseHerePopover),ee=(0,D.B)(d),ea=!!(!G&&!t.currentTopic&&!h&&0===ee.length&&!X&&0===n.length);return(0,r.jsxs)(r.Fragment,{children:[R&&k&&(0,r.jsx)(N,{fileContext:p[0],loading:S,setLoading:b,currentTab:j,setCurrentTab:A,makeCAPIRequest:O.p}),(!R||!!R&&"chat"===j)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(Z.$,{className:"copilot-chat-messages",style:{flex:"1 1 auto"},children:[G&&(0,r.jsx)(eV,{}),Q&&(0,r.jsx)(eH,{}),J&&!G&&(0,r.jsx)(ez,{inputRef:y,showQuotaExceededEmptyState:Y}),(0,r.jsx)(en.Cb,{})]}),ea&&(0,r.jsx)("div",{className:(0,L.$)("copilot-chat-messages",q.suggestedPromptsGrid),children:f.map((e,n)=>(0,r.jsx)(eK,{heading:e.heading,content:e.content,onSubmit:()=>{a.sendChatMessage({thread:(0,U.W)(t),content:e.content,references:t.currentReferences,topic:t.currentTopic,context:t.context}),(0,T.BI)("copilot_chat_suggestion_click",{topic:t.currentTopic?.name})}},n))}),!G&&!h&&!Y&&(0,r.jsx)("div",{className:(0,L.$)("copilot-chat-input copilot-chat-input-outer",q.chatInputContainer),children:x?(0,r.jsx)(ed,{}):(0,r.jsxs)(r.Fragment,{children:[!ea&&0===ee.length&&!t.showTopicPicker&&(0,r.jsx)(et,{suggestionKind:"initial"}),(0,r.jsxs)("div",{children:[v&&(0,r.jsx)(ev,{}),_&&(0,r.jsx)(H.P,{ambientError:_}),(0,r.jsx)(K.V,{modes:[{name:"Chat",supportsMCP:!0,supportsAttachments:!0,supportsModelSwitching:!0,supportsSpaces:!0,supportsAutocompletion:!0,icon:(0,r.jsx)(l.CommentIcon,{})}],textAreaRef:y,onSubmit:F,isStreaming:!!t.streamingMessage,size:"small"},m)]})]})})]}),(0,r.jsx)(en.zc,{})]})};function eK({heading:e,content:t,onSubmit:a}){return(0,r.jsxs)(u.Q,{onClick:a,className:q.suggestedPromptButton,children:[(0,r.jsx)(h.A,{as:"h3",className:q.promptHeading,children:e}),(0,r.jsx)("p",{className:q.promptDescription,children:t})]})}try{ez.displayName||(ez.displayName="Messages")}catch{}try{eV.displayName||(eV.displayName="Loading")}catch{}try{eH.displayName||(eH.displayName="Error")}catch{}try{eq.displayName||(eq.displayName="Chat")}catch{}try{eK.displayName||(eK.displayName="SuggestedPrompt")}catch{}},14521:(e,t,a)=>{a.d(t,{G:()=>c});var n=a(21728),r=a(79802),i=a(96540),s=a(2635),o=a(23657),l=a(72303);function c(){let e,t=(0,n.c)(1),a=(0,i.useRef)(null);t[0]===Symbol.for("react.memo_cache_sentinel")?(e=e=>{let t=(0,l.W)(e),n=(0,r.O)(t);return(0,o.Ym)(a.current,n)?a.current:(a.current=n,n)},t[0]=e):e=t[0];let c=(0,s.pn)(e);return(0,o.iI)()||c}},15838:(e,t,a)=>{a.d(t,{Cd:()=>l,E5:()=>o,Im:()=>c,nW:()=>s});var n=a(11083),r=a(94416);let i="stats:soft-nav-duration",s={turbo:"TURBO",react:"REACT","turbo.frame":"FRAME",ui:"UI",hard:"HARD"};function o(){window.performance.clearResourceTimings(),window.performance.mark(i)}function l(e){(0,n.i)({turboFailureReason:e,turboStartUrl:(0,r.dR)(),turboEndUrl:window.location.href})}function c(){let e=function(){if(0===performance.getEntriesByName(i).length)return null;performance.measure(i,i);let e=performance.getEntriesByName(i).pop();return e?e.duration:null}();if(!e)return;let t=s[(0,r.di)()],a=Math.round(e);t===s.react&&document.dispatchEvent(new CustomEvent("staffbar-update",{detail:{duration:a}})),(0,n.i)({requestUrl:window.location.href,softNavigationTiming:{mechanism:t,destination:(0,r.fX)()||"rails",duration:a,initiator:(0,r.Pv)()||"rails"}})}},16378:(e,t,a)=>{a.d(t,{O:()=>i,_:()=>s});var n=a(47970),r=a(99054);function i(e){let t=new Set;return(0,n.YR)(e,e=>{"reference-mention"===e.type&&void 0!==e.data.mentionedReferenceId&&t.add(e.data.mentionedReferenceId)}),t}function s(e){return r.qj.test(e.split(/\s/)[0]??"")}},17485:(e,t,a)=>{a.d(t,{C:()=>s});var n=a(25536),r=a(14521),i=a(96540);function s(){let e=(0,r.G)(),{selectedCopilotSpaceId:t,setSelectedCopilotSpaceId:a,selectedThreadId:s}=(0,n.O)(),o=!!s||!!e;(0,i.useEffect)(()=>{a(e||void 0)},[e,a]);let l=t||e,c=(0,i.useCallback)(e=>{o||a({id:e.id,owner:e.owner})},[a,o]),d=(0,i.useCallback)(()=>{o||a(void 0)},[a,o]);return{activeCopilotSpaceId:l,readOnly:o,handleSpaceSelect:c,clearSpaceSelection:d}}},17925:(e,t,a)=>{a.d(t,{V:()=>r});var n=a(35247);function r(e,t){if(0===t.length||!n.W.chatInputCommands)return null;let a=RegExp(`^\\/(${t.join("|")})(?:\\s|$)`,"i"),r=e.match(a);return r&&r[1]?r[1].toLowerCase():null}},20263:(e,t,a)=>{a.d(t,{BC:()=>l,JU:()=>d,Pk:()=>o});var n=a(74848),r=a(87448),i=a(99418),s=a(96540);let o=u(r.az),l=u(r.EY),c=(0,s.forwardRef)((e,t)=>(0,n.jsx)("div",{ref:t,...e}));c.displayName="Div";let d=u(c);function u(e){let t=(0,s.forwardRef)((t,a)=>{let{sanitizedHTML:r,props:s}=function(e){let{html:t,domPurifyConfig:a,...n}=e,r={...a,RETURN_DOM:!1,RETURN_DOM_FRAGMENT:!1};return{sanitizedHTML:i.default.sanitize(t,r),props:n}}(t);return(0,n.jsx)(e,{ref:a,...s,dangerouslySetInnerHTML:{__html:r}})});return t.displayName=`UnsafeHTML${e.displayName||e.name}`,t}try{d.displayName||(d.displayName="UnsafeHTMLDiv")}catch{}},26408:(e,t,a)=>{a.d(t,{U:()=>d});var n=a(16654),r=a(82490),i=a(96540),s=a(18312),o=a(2635),l=a(33592),c=a(23657);function d(e,t,a,m,h=!1){let[p,g]=(0,i.useState)(),f=(0,i.useCallback)(()=>g(void 0),[]),{topRepositoriesCache:y,currentRepository:x}=(0,o.Pk)(),v=(0,l.b)(),[C,_]=(0,i.useState)([]),[S,b]=(0,i.useState)(!y&&"initial"),j=(0,i.useRef)(void 0),w=(0,s.useRelayEnvironment)(),N=m&&""!==m.trim();if(p&&!y&&!e&&!N){let e=u(p||[]),{ownerLogin:t,name:a}=x??{};x&&!e.find(e=>`${e.ownerLogin}/${e.name}`==`${t}/${a}`)&&e.splice(0,0,{databaseId:x.id,isInOrganization:"Organization"===x.ownerType,name:x.name,nwo:`${x.ownerLogin}/${x.name}`,ownerLogin:x.ownerLogin,ownerAvatarUrl:`/${x.ownerLogin}.png?s=40`}),setTimeout(()=>v.setTopRepositoryTopics(e),10),b(!1),g(void 0)}let I=(0,i.useCallback)(async()=>{try{let e=await (0,n.St)(w,{first:a,owner:N?m:void 0});g(e)}catch{}finally{b(!1)}},[N,m,w,g,a]);return((0,i.useEffect)(()=>{t&&!N&&I()},[I,N,t,m]),(0,i.useEffect)(()=>{let t=async e=>{b(!0);let{repositories:t}=await (0,n.vO)(w,{query:N?(0,c.rl)(m,e,h):(0,r.J)(e,{includeForks:h}),onStart:e=>{j.current?.unsubscribe(),j.current=e}});_(t.length?u(t):[]),b(!1)};e||N?t(e):y&&_(y)},[e,N,m,w,y,h]),(0,i.useEffect)(()=>{v.setTopRepositoryTopics(void 0)},[v,m]),!y||e||N)?{repositories:C,loading:S,resetTopRepoResults:f}:{repositories:y,loading:!1,resetTopRepoResults:f}}function u(e){return e.map(({owner:{login:e,avatarUrl:t},isInOrganization:a,name:n,databaseId:r})=>({databaseId:r??0,isInOrganization:a,name:n,nwo:`${e}/${n}`,ownerLogin:e,ownerAvatarUrl:t}))}},27844:(e,t,a)=>{a.d(t,{W:()=>o});var n=a(74848),r=a(21728),i=a(77430),s=a(5524);function o(e){let t,a,o,l,c=(0,r.c)(14),{onSelect:d,repo:u,selected:m,trailingVisualComponent:h}=e,{databaseId:p,isInOrganization:g,nwo:f,ownerAvatarUrl:y}=u;return c[0]!==p||c[1]!==d?(t=()=>d(p),c[0]=p,c[1]=d,c[2]=t):t=c[2],c[3]!==g||c[4]!==y?(a=(0,n.jsx)(s.l.LeadingVisual,{children:(0,n.jsx)(i.r,{src:y,square:g,size:16})}),c[3]=g,c[4]=y,c[5]=a):a=c[5],c[6]!==h?(o=h&&(0,n.jsx)(s.l.TrailingVisual,{children:h}),c[6]=h,c[7]=o):o=c[7],c[8]!==f||c[9]!==m||c[10]!==t||c[11]!==a||c[12]!==o?(l=(0,n.jsxs)(s.l.Item,{onSelect:t,selected:m,children:[a,f,o]},f),c[8]=f,c[9]=m,c[10]=t,c[11]=a,c[12]=o,c[13]=l):l=c[13],l}try{o.displayName||(o.displayName="RepositoryListItem")}catch{}},28600:(e,t,a)=>{a.d(t,{A:()=>o});let{getItem:n,setItem:r,removeItem:i}=(0,a(82075).A)("localStorage"),s="REACT_PROFILING_ENABLED",o={enable:()=>r(s,"true"),disable:()=>i(s),isEnabled:()=>!!n(s)}},30459:(e,t,a)=>{a.d(t,{S:()=>l,s:()=>o});var n=a(21728),r=a(96540),i=a(53419),s=a(49936);function o(){let e,t,a=(0,n.c)(6),o=(0,r.useContext)(s.I);if(!o)throw Error("useAnalytics must be used within an AnalyticsContext");let{appName:l,category:c,metadata:d}=o;a[0]!==l||a[1]!==c||a[2]!==d?(e=(e,t,a)=>{let n={react:!0,app_name:l,category:c,...d};(0,i.BI)(e,{...n,...void 0===a?{}:a,target:t})},a[0]=l,a[1]=c,a[2]=d,a[3]=e):e=a[3];let u=e;return a[4]!==u?(t={sendAnalyticsEvent:u},a[4]=u,a[5]=t):t=a[5],t}function l(){let e,t,a=(0,n.c)(4),{sendAnalyticsEvent:r}=o();a[0]!==r?(e=e=>{r("analytics.click",void 0,void 0===e?{}:e)},a[0]=r,a[1]=e):e=a[1];let i=e;return a[2]!==i?(t={sendClickAnalyticsEvent:i},a[2]=i,a[3]=t):t=a[3],t}},30558:(e,t,a)=>{a.d(t,{c:()=>k});var n=a(74848),r=a(4817),i=a(98755),s=a(77430),o=a(53419),l=a(29731),c=a(38621),d=a(87448),u=a(34164),m=a(96540),h=a(52940),p=a(25641),g=a(2635),f=a(33592),y=a(55009),x=a(77939),v=a(46665),C=a(59524),_=a(88752),S=a(32744),b=a(82178),j=a(94517),w=a(73010),N=a(11633),I=a(31958),E=a(42983),T=a(82151),A=a(45244);let R=({isLatestMessage:e,isFirstReply:t,isStreaming:a,onClickReference:R,...k})=>{let{message:L}=(0,v.V)(),P=(0,g.Pk)(),M=(0,f.b)(),{author:O,handleConfirmationAction:D,handleRetryErrorMessage:F,hasClientConfirmations:B,isAI:$,isCopilot:z,isError:U,isAgentError:W,isInterrupted:V,isUser:H,myRef:q,rendererConfig:K,renderFeedback:G,shouldShowMessageActions:Q,skillExecutionToUseForRespondingText:Z,showRetryButton:J}=(0,h.p)({excludeFeedback:k.excludeFeedback,inputRef:k.inputRef,isLatestMessage:e,isStreaming:a,excludeReferencesFromFocusZone:!0}),Y=L.clientToolResults&&L.clientToolResults.length>0,X=L.clientSkillsRequests&&L.clientSkillsRequests.length>0,ee=H&&!Y,et=a||Y||X,ea=et&&e,en=z||Y,er=(0,m.useMemo)(()=>(0,p.rT)(L.references??[]),[L.references]),ei=(0,m.useMemo)(()=>(0,p.H2)(L.references??[]),[L.references]),es=(0,m.useMemo)(()=>M.maxMessagesReached(),[M]),eo=er.filter(e=>"image"!==e.type&&"org-instructions"!==e.type),el=(0,m.useMemo)(()=>L.mediaContent?.filter(e=>e.mediaType.startsWith("image/")),[L.mediaContent]),ec=(0,m.useMemo)(()=>void 0!==el&&el.length>0,[el]),ed=(0,m.useCallback)(e=>{let t=e.target.href,a=er.find(e=>e.url===t);a&&"immersive"===P.mode&&(M.selectReference(a),e.preventDefault())},[M,er,P.mode]),eu=(0,m.useCallback)(e=>{M.setWrapCodeLines(e)},[M]);return(0,n.jsxs)("div",{className:(0,u.$)("message-container",x.A.messageContainer,ee&&x.A.user,$&&x.A.ai),ref:q,...(0,l.G)(`message-${U?"error":a?"streaming":L.id}`),children:[ee&&ec&&(0,n.jsx)("div",{children:el?.map(e=>(0,n.jsx)(y.o,{src:e?.url||"",alt:"Uploaded image",mode:P.mode},e?.url||""))}),en||Y?(0,n.jsx)(b.W,{isLoading:et&&e,isError:U&&L.error?.type!=="agentUnauthorized",mode:P.mode,isFirstMessage:t,isLoadingSkills:(L.skillExecutions??[]).length>0&&et&&""===L.content&&e,message:L.content||"",createdAt:L.createdAt}):$?(0,n.jsx)("div",{className:x.A.avatar,children:(0,n.jsx)(s.r,{src:O.avatarURL,size:24,"aria-label":`${O.name} avatar`,alt:`${O.name} avatar`,"data-testid":"chat-message-author-avatar"})}):null,ee&&(0,n.jsx)(_.t,{size:"small",className:"mb-2",references:eo,message:L,onClickReference:R}),(0,n.jsxs)("div",{className:(0,u.$)(x.A.message,ee&&x.A.user),children:[B&&L.clientConfirmations?.length?(0,n.jsx)(d.az,{className:(0,u.$)("my-1",x.A.clientConfirmationContainer),sx:{justifyContent:ee?"flex-end":""},"data-testid":"chat-message-client-confirmations",children:(0,n.jsxs)("span",{className:x.A.confirmationStatusText,children:[(0,n.jsx)(c.CheckIcon,{})," ",L.clientConfirmations?.[0]?.userLogin||"User"," ",L.clientConfirmations?.[0]?.state," the action"]})}):null,z&&ea&&!L.content&&(0,n.jsx)(A.b,{className:(0,u.$)(x.A.skillExecutionText,"mb-2 mt-1 ml-2"),children:`${(0,N.WA)(Z)}...`}),(0,n.jsx)("div",{className:(0,u.$)(x.A.messageContent,!!B&&x.A.hasClientConfirmations),children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:(0,u.$)("js-snippet-clipboard-copy-unpositioned",x.A.messageContentWrapper),children:["assistant"===L.role&&L.content&&(er?.length?(0,n.jsx)(_.s,{className:"mb-2",references:er}):null),"assistant"===L.role&&(ei.length?(0,n.jsx)(C.Q,{mcpToolResults:ei}):null),!B&&(ee?(0,n.jsx)(T.R,{}):L.content&&(0,n.jsx)(r.To,{markdown:L.content,onLinkClick:ed,chatMode:"assistive",wrapCodeLines:P.wrapCodeLines,onWrapCodeLinesChange:eu,...K})),U?(0,n.jsx)(j.K,{manager:M}):null,W&&L.agentErrors?.length?(0,n.jsx)(j.h,{errors:L.agentErrors}):null,V?(0,n.jsx)(I.h,{messageHasContent:!!L.content||!!L.skillExecutions?.length}):null,(z||(0,p.yh)(O))&&(0,p.Ye)(L.confirmations).map((t,a)=>"indexrepo"===t.confirmation.name?null:(0,n.jsx)(S.m,{confirmation:t,handleConfirmation:D,isLatestMessage:e},a))]}),!Q&&J&&(0,n.jsx)(E.$,{handleRetryMessage:F,disabled:es}),Q&&(0,n.jsxs)(d.az,{className:(0,u.$)("message-actions",x.A.messageActionsContainer),"data-testid":"message-action-bar",sx:{position:e?void 0:"absolute",bottom:e?void 0:"-2.25rem",borderRadius:e?void 0:2,boxShadow:e?void 0:"var(--shadow-floating-small)",opacity:e?void 0:0,pointerEvents:e?void 0:"none","&::before":{content:e?void 0:'""',position:"absolute"}},children:[G&&(0,n.jsx)(w.G,{iconSize:"small"}),z&&!!L.content&&!a&&(0,n.jsx)(i.T,{textToCopy:L.content??"",ariaLabel:"Copy to clipboard",size:"small",className:"d-flex flex-items-center",onCopy:()=>{(0,o.BI)("copilot_chat.activate",{target:"CHAT_MESSAGE_COPY",mode:P.mode})}}),J&&(0,n.jsx)(E.$,{handleRetryMessage:F,disabled:es})]})]})})]})]})},k=({message:e,...t})=>(0,n.jsx)(v.$,{message:e,children:(0,n.jsx)(R,{...t})});try{R.displayName||(R.displayName="InnerChatMessage")}catch{}try{k.displayName||(k.displayName="ChatMessage")}catch{}},31971:(e,t,a)=>{a.d(t,{M:()=>n});function n(e){switch(e.type){case"repository":return{repository_id:e.repositoryId};case"github_file":return{repository_id:e.repositoryId,file_path:e.filePath,sha:e.sha};case"free_text":return{text:e.text,name:e.name};case"github_issue":case"github_pull_request":return{repository_id:e.repositoryId,number:e.number};case"uploaded_text_file":return{name:e.name};case"media_content":return{media_type:e.mediaType,name:e.name,url:e.url,height:e.height,width:e.width};default:throw Error("Unsupported resource")}}},33544:(e,t,a)=>{a.d(t,{x:()=>g});var n=a(74848),r=a(38621),i=a(57352),s=a(94236),o=a(5524),l=a(87448),c=a(88934),d=a(96540),u=a(11083),m=a(62227),h=a(34164),p=a(69599);function g({className:e,portalContainerName:t,protectedOrgs:a,maxVisibleOrgNames:s=3,redirectURI:o,useFullWidthStyle:g,forceWrap:x,sx:v}){let C=(0,c.zy)(),_=(0,d.useRef)(!1);if((0,d.useEffect)(()=>{(0,p.G7)("record_sso_banner_metrics")&&!_.current&&a&&a.length>0&&((0,u.i)({incrementKey:(0,p.G7)("global_sso_banner")?"LEGACY_SSO_BANNER_DISPLAYED_WITH_GLOBAL_BANNER_ENABLED":"LEGACY_SSO_BANNER_DISPLAYED",requestUrl:window.location.href}),_.current=!0)},[a]),!a||0===a.length)return null;let S=Math.max(0,a.length-s),b=1===a.length||S>0?(0,n.jsx)("b",{children:a.slice(0,s).join(", ")}):(0,n.jsxs)("span",{children:[(0,n.jsx)("b",{children:a.slice(0,a.length-1).join(", ")}),a.length>2&&","," and ",(0,n.jsx)("b",{children:a[a.length-1]})]});return(0,n.jsx)(l.az,{sx:v,className:e,"data-testid":"sso-banner",children:(0,n.jsx)("div",{className:m.A.Box,children:(0,n.jsx)("section",{"aria-label":"Single sign-on information",children:(0,n.jsx)(l.Hx,{sx:{borderRadius:2*!g,borderWidth:g?"1px 0":1},className:m.A.Flash,children:1===a.length?(0,n.jsxs)("div",{children:[(0,n.jsx)(r.ShieldLockIcon,{className:m.A.ShieldLockIcon}),(0,n.jsx)(i.A,{inline:!0,href:`/orgs/${a[0]}/sso?return_to=${y({location:C,redirectURI:o})}`,children:"Single sign-on"})," ","to see results in the ",(0,n.jsx)("b",{children:a[0]})," organization."]}):(0,n.jsxs)("div",{className:m.A.Box_1,children:[(0,n.jsx)(r.ShieldLockIcon,{className:m.A.Octicon}),(0,n.jsxs)("div",{className:(0,h.$)(m.A.Box_2,x&&m.A.ForceWrap),children:[(0,n.jsxs)("p",{className:m.A.ProtectedOrgs_FullList,children:["Single sign-on to see results in ",0===S&&"the ",s>0&&(0,n.jsxs)(n.Fragment,{children:[b," "]}),S>0&&(0,n.jsxs)(n.Fragment,{children:[s>0&&"and ",S," other"," "]}),a.length>1&&1!==S?"organizations":"organization","."]}),(0,n.jsx)("p",{className:m.A.ProtectedOrgs_Shortened,children:"Single sign-on to see results in your organizations"}),(0,n.jsx)("div",{style:{flexShrink:0},children:(0,n.jsx)(f,{portalContainerName:t,protectedOrgs:a,redirectURI:o})})]})]})})})})})}function f({portalContainerName:e,protectedOrgs:t,redirectURI:a}){let r=(0,c.zy)();return(0,n.jsxs)(s.W,{children:[(0,n.jsx)(s.W.Button,{size:"small",children:"Select an organization"}),(0,n.jsx)(s.W.Overlay,{portalContainerName:e,children:(0,n.jsx)(o.l,{children:t.map(e=>(0,n.jsx)(o.l.Item,{onSelect:()=>{window.location.href=`/orgs/${encodeURIComponent(e)}/sso?return_to=${y({location:r,redirectURI:a})}`},children:e},`org-${e}`))})})]})}function y({location:e,redirectURI:t}){return encodeURIComponent(t?t(e):e.pathname+e.search+e.hash)}try{g.displayName||(g.displayName="SingleSignOnBanner")}catch{}try{f.displayName||(f.displayName="SingleSignOnButton")}catch{}},35673:(e,t,a)=>{a.d(t,{UJ:()=>y,E5:()=>c,Dq:()=>d,Gj:()=>u,f1:()=>m,cB:()=>h,zc:()=>p,Cb:()=>g,hl:()=>f});var n=a(74848),r=a(21728),i=a(56149),s=a(94236),o=a(96540);let l={chatPortalContainer:"PortalContainerUtils-module__chatPortalContainer--Otmle",menuPortalContainer:"PortalContainerUtils-module__menuPortalContainer--D7AeL"},c="copilotChatMenuPortalRoot",d="copilotChatMessagesMenuPortalRoot",u="copilotChatPortalRoot",m="copilotChatTopicPickerPortalRoot",h=()=>{let e,t,a,s=(0,r.c)(3),c=(0,o.useRef)(null);return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{(0,i.cw)(c.current,u)},t=[],s[0]=e,s[1]=t):(e=s[0],t=s[1]),(0,o.useEffect)(e,t),s[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,n.jsx)("div",{ref:c,className:l.chatPortalContainer}),s[2]=a):a=s[2],a},p=()=>{let e,t,a,s=(0,r.c)(3),d=(0,o.useRef)(null);return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{(0,i.cw)(d.current,c)},t=[],s[0]=e,s[1]=t):(e=s[0],t=s[1]),(0,o.useEffect)(e,t),s[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,n.jsx)("div",{ref:d,className:l.menuPortalContainer}),s[2]=a):a=s[2],a},g=()=>{let e,t,a,s=(0,r.c)(3),l=(0,o.useRef)(null);return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{(0,i.cw)(l.current,d)},t=[],s[0]=e,s[1]=t):(e=s[0],t=s[1]),(0,o.useEffect)(e,t),s[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,n.jsx)("div",{ref:l}),s[2]=a):a=s[2],a},f=()=>{let e,t,a,s=(0,r.c)(3),l=(0,o.useRef)(null);return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{(0,i.cw)(l.current,m)},t=[],s[0]=e,s[1]=t):(e=s[0],t=s[1]),(0,o.useEffect)(e,t),s[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,n.jsx)("div",{ref:l}),s[2]=a):a=s[2],a},y=e=>{let t,a,i,l,d,u,m=(0,r.c)(10);m[0]!==e?({children:t,portalContainerName:i,...a}=e,m[0]=e,m[1]=t,m[2]=a,m[3]=i):(t=m[1],a=m[2],i=m[3]);let[h,p]=(0,o.useState)(x);if(m[4]===Symbol.for("react.memo_cache_sentinel")?(l=()=>p(!0),d=[],m[4]=l,m[5]=d):(l=m[4],d=m[5]),(0,o.useEffect)(l,d),!h)return null;let g=i||c;return m[6]!==t||m[7]!==a||m[8]!==g?(u=(0,n.jsx)(s.W.Overlay,{...a,portalContainerName:g,children:t}),m[6]=t,m[7]=a,m[8]=g,m[9]=u):u=m[9],u};try{h.displayName||(h.displayName="ChatPortalContainer")}catch{}try{p.displayName||(p.displayName="MenuPortalContainer")}catch{}try{g.displayName||(g.displayName="MessagesPortalContainer")}catch{}try{f.displayName||(f.displayName="TopicPickerPortalContainer")}catch{}try{y.displayName||(y.displayName="ActionMenuOverlay")}catch{}function x(){return"undefined"!=typeof document}},39176:(e,t,a)=>{a.d(t,{k:()=>n});function n(e){return function e(t,a){let n=t[a];return n?n.items.map(a=>({data:a,items:"directory"===a.contentType?e(t,a.path):[]})).sort((e,t)=>"directory"===e.data.contentType&&"directory"!==t.data.contentType?-1:"directory"!==e.data.contentType&&"directory"===t.data.contentType?1:e.data.name.localeCompare(t.data.name)):[]}(function(e){let{paths:t,directories:a}=e,n={},r=new Set(a);for(let e of(n[""]={items:[],totalCount:0},[...a].sort())){let t=e.substring(0,e.lastIndexOf("/"))||"",a={name:e.substring(e.lastIndexOf("/")+1),path:e,contentType:"directory"};n[t]||(n[t]={items:[],totalCount:0}),n[t].items.push(a),n[e]||(n[e]={items:[],totalCount:0})}for(let e of t.filter(e=>!r.has(e)).sort()){let t=e.substring(0,e.lastIndexOf("/"))||"",a={name:e.substring(e.lastIndexOf("/")+1),path:e,contentType:"file"};n[t]||(n[t]={items:[],totalCount:0}),n[t].items.push(a)}for(let e in n){let t=n[e];t&&t.items.sort((e,t)=>"directory"===e.contentType&&"directory"!==t.contentType?-1:"directory"!==e.contentType&&"directory"===t.contentType?1:e.name.localeCompare(t.name))}let i=e=>{let t=n[e];return t?t.items.reduce((e,t)=>"directory"===t.contentType?e+1+i(t.path):e+1,0):0};for(let e in n){let t=n[e];t&&(t.totalCount=i(e))}return n}(e),"")}},40064:(e,t,a)=>{a.d(t,{V:()=>m});var n=a(74848),r=a(96540),i=a(43258),s=a(38621),o=a(52870),l=a(56149);let c={info:"",success:"Toast--success",error:"Toast--error"},d={info:(0,n.jsx)(s.InfoIcon,{}),success:(0,n.jsx)(s.CheckIcon,{}),error:(0,n.jsx)(s.StopIcon,{})},u=({message:e,timeToLive:t,icon:a,type:i="info",role:s="log"})=>{let[u,m]=r.useState(!0),{safeSetTimeout:h}=(0,o.A)();return(0,r.useEffect)(()=>{t&&h(()=>m(!1),t-300)},[h,t]),(0,n.jsx)(l.ZL,{children:(0,n.jsx)("div",{className:"p-1 position-fixed bottom-0 left-0 mb-3 ml-3",children:(0,n.jsxs)("div",{className:`Toast ${c[i]} ${u?"Toast--animateIn":"Toast--animateOut"}`,id:"ui-app-toast","data-testid":`ui-app-toast-${i}`,role:s,children:[(0,n.jsx)("span",{className:"Toast-icon",children:a||d[i]}),(0,n.jsx)("span",{className:"Toast-content",children:e})]})})})};try{u.displayName||(u.displayName="Toast")}catch{}function m(){let{toasts:e,persistedToast:t}=(0,r.useContext)(i.T8);return(0,n.jsxs)(n.Fragment,{children:[e.map((e,t)=>(0,n.jsx)(u,{message:e.message,icon:e.icon,timeToLive:i.Qn,type:e.type,role:e.role},t)),t&&(0,n.jsx)(u,{message:t.message,icon:t.icon,type:t.type,role:t.role})]})}try{m.displayName||(m.displayName="Toasts")}catch{}},44956:(e,t,a)=>{a.d(t,{m:()=>s});var n=a(74848),r=a(21373);let i={footerContainer:"SpaceDialogFooter-module__footerContainer--J2LGP"};function s({onSave:e,onCancel:t,saveButtonText:a,isLoading:s=!1,loadingAnnouncement:o="",disabled:l=!1}){return(0,n.jsxs)("div",{className:i.footerContainer,children:[(0,n.jsx)(r.Q,{variant:"default",onClick:t,children:"Cancel"}),(0,n.jsx)(r.Q,{variant:"primary",loading:s,loadingAnnouncement:o,onClick:e,disabled:l,children:a})]})}try{s.displayName||(s.displayName="SpaceDialogFooter")}catch{}},46642:(e,t,a)=>{a.d(t,{P:()=>d});var n=a(74848),r=a(96540),i=a(38621),s=a(69497),o=a(21373),l=a(70170),c=a(86391);function d({currentSelection:e,repositoryLoader:t,onSelect:a,selectionVariant:d,selectAllOption:u,additionalButtonProps:m,buttonText:h="",width:p,truncateMaxWidth:g,height:f,fullscreenOnNarrow:y,defaultOwner:x,onLoad:v}){let[C,_]=(0,r.useState)(""),[S,b]=(0,r.useState)([]),[j,w]=(0,r.useState)(!0),N=(0,r.useCallback)((0,l.s)(async e=>{try{let a=await t(e,x);b(a),v?.(a)}catch{}w(!1)},200),[t,x]);(0,r.useEffect)(()=>{w(!0),N(C)},[C,N,w]);let I=(0,r.useCallback)(e=>{"single"===d?!e[0]||e[0]._all?a(void 0):a(e[0]):a(e)},[d,a]),E=(0,r.useMemo)(()=>"multiple"===d?e||[]:e?[e]:[],[d,e]),T=(0,r.useCallback)(e=>{let t,a="medium"===p?35:"large"===p?60:24;return(e.name.length>a&&(t=`${e.name.substring(0,a)}...`),e._all)?{id:e.name,text:"All repositories",source:e,groupId:"all"}:{id:e.name,text:t||e.name,source:e,groupId:"select",disabled:!1===e.enabled,leadingVisual:()=>e.private?(0,n.jsx)(i.RepoLockedIcon,{size:16}):(0,n.jsx)(i.RepoIcon,{size:16})}},[p]),A=(0,r.useCallback)(e=>e.name,[]),R=(0,r.useMemo)(()=>{let e=[];return e.push(...E.filter(e=>S.every(t=>t.name!==e.name))||[]),e.push(...S),u&&e.push({name:"$all$",_all:!0}),e},[S,u,E]),k=h,L=i.RepoIcon;return k||("multiple"===d?k=E.length>0?`${E.length} repositor${E.length>1?"ies":"y"}`:"Select repositories":E.length>0&&E[0]?(k=E[0].name,L=E[0].private?i.RepoLockedIcon:i.RepoIcon):k=u?"All repositories":"Select a repository"),(0,n.jsx)(c.O,{renderAnchor:({"aria-labelledby":e,...t})=>(0,n.jsx)(o.Q,{leadingVisual:L,trailingAction:i.TriangleDownIcon,"aria-labelledby":e,...t,...m,children:(0,n.jsx)(s.A,{title:k,maxWidth:g??195,children:k})}),placeholderText:"Search",items:R,loading:j,groups:u?[{groupId:"all"},{groupId:"select"}]:[],selectionVariant:d,initialSelectedItems:E,onSelectionChange:I,filterItems:_,getItemKey:A,convertToItemProps:T,title:"Select a repository",width:p,height:f,responsiveOnNarrow:y})}try{d.displayName||(d.displayName="ReposSelector")}catch{}},49851:(e,t,a)=>{a.d(t,{Dy:()=>l,FD:()=>h,GS:()=>i,KJ:()=>s,LP:()=>c,OZ:()=>y,c9:()=>f,gh:()=>g,hO:()=>u,j6:()=>d,md:()=>m,wB:()=>p});var n=a(74848),r=a(21728);let i=e=>{let t,a,i,s,o,l,c,d=(0,r.c)(10);d[0]!==e?(t=void 0===e?{}:e,d[0]=e,d[1]=t):t=d[1];let{size:u,className:m}=t,h=void 0===u?16:u;return d[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},d[2]=a):a=d[2],d[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,n.jsx)("path",{d:"M11.1997 3.60004H12.4797C13.5401 3.60004 14.3997 4.45965 14.3997 5.52004V10.64C14.3997 11.7005 13.5401 12.56 12.4797 12.56H11.1997",stroke:"currentColor",strokeLinecap:"round"}),s=(0,n.jsx)("path",{d:"M4.79985 12.56H3.51985C2.45947 12.56 1.59985 11.7005 1.59985 10.64V5.52004C1.59985 4.45965 2.45947 3.60004 3.51985 3.60004H4.79985",stroke:"currentColor",strokeLinecap:"round"}),o=(0,n.jsx)("path",{d:"M8.00015 5.2C8.8838 5.2 9.60015 4.48366 9.60015 3.6C9.60015 2.71634 8.8838 2 8.00015 2C7.11649 2 6.40015 2.71634 6.40015 3.6C6.40015 4.48366 7.11649 5.2 8.00015 5.2Z",fill:"currentColor"}),l=(0,n.jsx)("path",{d:"M8.00015 14.16C8.8838 14.16 9.60015 13.4437 9.60015 12.56C9.60015 11.6764 8.8838 10.96 8.00015 10.96C7.11649 10.96 6.40015 11.6764 6.40015 12.56C6.40015 13.4437 7.11649 14.16 8.00015 14.16Z",fill:"currentColor"}),d[3]=i,d[4]=s,d[5]=o,d[6]=l):(i=d[3],s=d[4],o=d[5],l=d[6]),d[7]!==m||d[8]!==h?(c=(0,n.jsxs)("svg",{className:m,width:h,height:h,style:a,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[i,s,o,l]}),d[7]=m,d[8]=h,d[9]=c):c=d[9],c},s=e=>{let t,a,i,s,o=(0,r.c)(7);o[0]!==e?(t=void 0===e?{}:e,o[0]=e,o[1]=t):t=o[1];let{size:l,className:c}=t,d=void 0===l?16:l;return o[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},i=(0,n.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.515.456a1.555 1.555 0 00-2.2 0L6.58 6.19a1.556 1.556 0 00-.396.673l-.825 2.89a.667.667 0 00.824.824l2.89-.826c.254-.072.485-.209.672-.396l5.735-5.734a1.556 1.556 0 000-2.2l-.965-.965zm-1.257.942a.222.222 0 01.314 0l.965.966a.222.222 0 010 .314L13.415 3.8l-1.28-1.28 1.123-1.122zm-2.065 2.066l1.279 1.279-3.67 3.67a.221.221 0 01-.096.056l-1.736.496.496-1.736c.01-.036.03-.07.057-.096l3.67-3.67zM1.639 4.778a2.25 2.25 0 012.25-2.25h3.154a.75.75 0 000-1.5H3.889a3.75 3.75 0 00-3.75 3.75v7.333a3.75 3.75 0 003.75 3.75h7.333a3.75 3.75 0 003.75-3.75V8.445a.75.75 0 00-1.5 0v3.666a2.25 2.25 0 01-2.25 2.25H3.889a2.25 2.25 0 01-2.25-2.25V4.778z",clipRule:"evenodd"}),o[2]=a,o[3]=i):(a=o[2],i=o[3]),o[4]!==c||o[5]!==d?(s=(0,n.jsx)("svg",{className:c,width:d,height:d,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",style:a,children:i}),o[4]=c,o[5]=d,o[6]=s):s=o[6],s},o=e=>{let t,a,i,s,o=(0,r.c)(7);o[0]!==e?(t=void 0===e?{}:e,o[0]=e,o[1]=t):t=o[1];let{size:l,className:c}=t,d=void 0===l?16:l;return o[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},i=(0,n.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13 .5H3A2.5 2.5 0 0 0 .5 3v10A2.5 2.5 0 0 0 3 15.5h10a2.5 2.5 0 0 0 2.5-2.5V3A2.5 2.5 0 0 0 13 .5M2 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1zm6 6.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5M12.25 5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0M5 12.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5",clipRule:"evenodd"}),o[2]=a,o[3]=i):(a=o[2],i=o[3]),o[4]!==c||o[5]!==d?(s=(0,n.jsx)("svg",{className:c,width:d,height:d,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",style:a,children:i}),o[4]=c,o[5]=d,o[6]=s):s=o[6],s},l=e=>{let t,a,i,s,o,l=(0,r.c)(8);l[0]!==e?(t=void 0===e?{}:e,l[0]=e,l[1]=t):t=l[1];let{size:c,className:d}=t,u=void 0===c?16:c;return l[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},i=(0,n.jsx)("path",{d:"M7.41299 14.25H1.75C1.19772 14.25 0.75 13.8023 0.75 13.25V2.75C0.75 2.19772 1.19772 1.75 1.75 1.75H5C5.31476 1.75 5.61115 1.89819 5.8 2.15L6.7 3.35C6.88885 3.60181 7.18524 3.75 7.5 3.75H14.25C14.8023 3.75 15.25 4.19772 15.25 4.75V8.48779",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),s=(0,n.jsx)("path",{d:"M12.265 9.15977C12.3446 8.94235 12.6521 8.94235 12.7317 9.15977L12.9693 9.80865C13.3464 10.8387 14.158 11.6503 15.1881 12.0274L15.8369 12.265C16.0544 12.3446 16.0544 12.6521 15.8369 12.7317L15.1881 12.9692C14.158 13.3463 13.3464 14.158 12.9693 15.188L12.7317 15.8369C12.6521 16.0543 12.3446 16.0543 12.265 15.8369L12.0275 15.188C11.6504 14.158 10.8387 13.3463 9.80871 12.9692L9.15983 12.7317C8.94241 12.6521 8.94241 12.3446 9.15983 12.265L9.80871 12.0274C10.8387 11.6503 11.6504 10.8387 12.0275 9.80865L12.265 9.15977Z",fill:"currentColor"}),l[2]=a,l[3]=i,l[4]=s):(a=l[2],i=l[3],s=l[4]),l[5]!==d||l[6]!==u?(o=(0,n.jsxs)("svg",{className:d,width:u,height:u,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",style:a,children:[i,s]}),l[5]=d,l[6]=u,l[7]=o):o=l[7],o},c=e=>{let t,a,i,s,o,l=(0,r.c)(8);l[0]!==e?(t=void 0===e?{}:e,l[0]=e,l[1]=t):t=l[1];let{size:c,className:d}=t,u=void 0===c?16:c;return l[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},i=(0,n.jsx)("path",{d:"M16.0376 9.67565V5.82038C16.0376 5.69043 15.9257 5.58508 15.7876 5.58508H11.6914C11.4687 5.58508 11.3571 5.83853 11.5146 5.98676L15.6108 9.84196C15.7683 9.99019 16.0376 9.88525 16.0376 9.67565Z",fill:"currentColor"}),s=(0,n.jsx)("path",{d:"M1.89601 3.25629C4.26064 1.03075 8.04807 0.960969 10.5015 3.04765L10.7339 3.25629L10.7857 3.3096C11.0259 3.58685 11.0085 3.99602 10.7339 4.25445C10.4593 4.51252 10.0254 4.52825 9.73097 4.30225L9.67336 4.25445L9.4966 4.09544C7.63201 2.50983 4.75358 2.56313 2.95656 4.25445C1.10158 6.00031 1.10158 8.83023 2.95656 10.5761C4.81155 12.322 7.8184 12.3219 9.67336 10.5761L13.563 6.91622C13.8559 6.64063 14.3307 6.64058 14.6236 6.91622C14.9163 7.19186 14.9163 7.63873 14.6236 7.91438L10.7339 11.5752C8.29328 13.8718 4.33667 13.8718 1.89601 11.5752C-0.544758 9.27799 -0.544771 5.55349 1.89601 3.25629Z",fill:"currentColor"}),l[2]=a,l[3]=i,l[4]=s):(a=l[2],i=l[3],s=l[4]),l[5]!==d||l[6]!==u?(o=(0,n.jsxs)("svg",{className:d,width:u,height:u,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",style:a,children:[i,s]}),l[5]=d,l[6]=u,l[7]=o):o=l[7],o},d=e=>{let t,a,i,s,o,l=(0,r.c)(8);l[0]!==e?(t=void 0===e?{}:e,l[0]=e,l[1]=t):t=l[1];let{size:c,className:d}=t,u=void 0===c?16:c;return l[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},l[2]=a):a=l[2],l[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,n.jsxs)("g",{clipPath:"url(#boolean-on-a)",children:[(0,n.jsx)("rect",{x:"1.25",y:"1.25",width:"13.5",height:"13.5",rx:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("rect",{x:"7",y:"5",width:"2",height:"6",rx:"1",fill:"currentColor"})]}),l[3]=i):i=l[3],l[4]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsx)("defs",{children:(0,n.jsx)("clipPath",{id:"boolean-on-a",children:(0,n.jsx)("rect",{width:"16",height:"16",fill:"white"})})}),l[4]=s):s=l[4],l[5]!==d||l[6]!==u?(o=(0,n.jsxs)("svg",{className:d,xmlns:"http://www.w3.org/2000/svg",width:u,height:u,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",style:a,children:[i,s]}),l[5]=d,l[6]=u,l[7]=o):o=l[7],o},u=e=>{let t,a,i,s,o,l=(0,r.c)(8);l[0]!==e?(t=void 0===e?{}:e,l[0]=e,l[1]=t):t=l[1];let{size:c,className:d}=t,u=void 0===c?16:c;return l[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},l[2]=a):a=l[2],l[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,n.jsxs)("g",{clipPath:"url(#boolean-off-a)",children:[(0,n.jsx)("rect",{x:"1.25",y:"1.25",width:"13.5",height:"13.5",rx:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"2.25",stroke:"currentColor",strokeWidth:"1.5"})]}),l[3]=i):i=l[3],l[4]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsx)("defs",{children:(0,n.jsx)("clipPath",{id:"boolean-off-a",children:(0,n.jsx)("rect",{width:"16",height:"16",fill:"white"})})}),l[4]=s):s=l[4],l[5]!==d||l[6]!==u?(o=(0,n.jsxs)("svg",{className:d,xmlns:"http://www.w3.org/2000/svg",width:u,height:u,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",style:a,children:[i,s]}),l[5]=d,l[6]=u,l[7]=o):o=l[7],o},m=e=>{let t,a,i,s,o,l,c,d=(0,r.c)(10);d[0]!==e?(t=void 0===e?{}:e,d[0]=e,d[1]=t):t=d[1];let{size:u,className:m}=t,h=void 0===u?16:u;return d[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},i=(0,n.jsx)("rect",{x:"1.25",y:"3.25",width:"13.5",height:"9.5",rx:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),s=(0,n.jsx)("path",{d:"M6 6L6 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),o=(0,n.jsx)("path",{d:"M4 6H8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),l=(0,n.jsx)("path",{d:"M9 10L12 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),d[2]=a,d[3]=i,d[4]=s,d[5]=o,d[6]=l):(a=d[2],i=d[3],s=d[4],o=d[5],l=d[6]),d[7]!==m||d[8]!==h?(c=(0,n.jsxs)("svg",{className:m,xmlns:"http://www.w3.org/2000/svg",width:h,height:h,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",style:a,children:[i,s,o,l]}),d[7]=m,d[8]=h,d[9]=c):c=d[9],c},h=e=>{let t,a,i,s,o,l,c,d,u,m=(0,r.c)(12);m[0]!==e?(t=void 0===e?{}:e,m[0]=e,m[1]=t):t=m[1];let{size:h,className:p}=t,g=void 0===h?16:h;return m[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},i=(0,n.jsx)("path",{d:"M13 11.25L12.25 11.25L12.25 12.75L13 12.75L13 12L13 11.25ZM14 12.75C14.4142 12.75 14.75 12.4142 14.75 12C14.75 11.5858 14.4142 11.25 14 11.25L14 12L14 12.75ZM13 12L13 12.75L14 12.75L14 12L14 11.25L13 11.25L13 12Z",fill:"currentColor"}),s=(0,n.jsx)("path",{d:"M2 11.25C1.58579 11.25 1.25 11.5858 1.25 12C1.25 12.4142 1.58579 12.75 2 12.75L2 12L2 11.25ZM7 12.75L7.75 12.75L7.75 11.25L7 11.25L7 12L7 12.75ZM2 12L2 12.75L7 12.75L7 12L7 11.25L2 11.25L2 12Z",fill:"currentColor"}),o=(0,n.jsx)("circle",{cx:"10",cy:"12",r:"2.25",stroke:"currentColor",strokeWidth:"1.5"}),l=(0,n.jsx)("path",{d:"M2 3.25C1.58579 3.25 1.25 3.58579 1.25 4C1.25 4.41421 1.58579 4.75 2 4.75L2 4L2 3.25ZM3 4.75L3.75 4.75L3.75 3.25L3 3.25L3 4L3 4.75ZM2 4L2 4.75L3 4.75L3 4L3 3.25L2 3.25L2 4Z",fill:"currentColor"}),c=(0,n.jsx)("path",{d:"M9 3.25L8.25 3.25L8.25 4.75L9 4.75L9 4L9 3.25ZM14 4.75C14.4142 4.75 14.75 4.41421 14.75 4C14.75 3.58579 14.4142 3.25 14 3.25L14 4L14 4.75ZM9 4L9 4.75L14 4.75L14 4L14 3.25L9 3.25L9 4Z",fill:"currentColor"}),d=(0,n.jsx)("circle",{cx:"6",cy:"4",r:"2.25",stroke:"currentColor",strokeWidth:"1.5"}),m[2]=a,m[3]=i,m[4]=s,m[5]=o,m[6]=l,m[7]=c,m[8]=d):(a=m[2],i=m[3],s=m[4],o=m[5],l=m[6],c=m[7],d=m[8]),m[9]!==p||m[10]!==g?(u=(0,n.jsxs)("svg",{className:p,xmlns:"http://www.w3.org/2000/svg",width:g,height:g,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",style:a,children:[i,s,o,l,c,d]}),m[9]=p,m[10]=g,m[11]=u):u=m[11],u},p=e=>{let t,a,i,s,o,l=(0,r.c)(8);l[0]!==e?(t=void 0===e?{}:e,l[0]=e,l[1]=t):t=l[1];let{size:c,className:d}=t,u=void 0===c?16:c;return l[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},i=(0,n.jsx)("rect",{x:"1.25",y:"3.25",width:"13.5",height:"9.5",rx:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),s=(0,n.jsx)("path",{d:"M9.81055 7.75L11.1895 7.75L10.5 8.43945L9.81055 7.75Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),l[2]=a,l[3]=i,l[4]=s):(a=l[2],i=l[3],s=l[4]),l[5]!==d||l[6]!==u?(o=(0,n.jsxs)("svg",{className:d,xmlns:"http://www.w3.org/2000/svg",width:u,height:u,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",style:a,children:[i,s]}),l[5]=d,l[6]=u,l[7]=o):o=l[7],o},g=e=>{let t,a,i,s,o,l=(0,r.c)(8);l[0]!==e?(t=void 0===e?{}:e,l[0]=e,l[1]=t):t=l[1];let{size:c,className:d}=t,u=void 0===c?16:c;return l[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},i=(0,n.jsx)("path",{d:"M15.2596 9.99995C15.4583 10.0025 15.6481 10.0834 15.787 10.2255C15.9258 10.3678 16.0022 10.5599 15.9999 10.7587C15.9974 10.9577 15.9166 11.1481 15.7743 11.2871L11.2167 15.7363C11.0753 15.8738 10.8855 15.9505 10.6883 15.9492C10.4909 15.9477 10.3013 15.8683 10.162 15.7285L8.21861 13.7783C8.08642 13.6359 8.01462 13.4472 8.01841 13.2529C8.02225 13.0587 8.10151 12.8734 8.23911 12.7363C8.37676 12.5992 8.56243 12.5206 8.75669 12.5175C8.95096 12.5145 9.1392 12.587 9.28111 12.7197L10.7001 14.1455L14.7264 10.2128C14.8688 10.074 15.0608 9.99751 15.2596 9.99995Z",fill:"currentColor"}),s=(0,n.jsx)("path",{d:"M11.75 1C12.9926 1 14 2.00736 14 3.25C14 4.22966 13.3739 5.06319 12.5 5.37207V6C12.5 7.38071 11.3807 8.5 10 8.5H6C5.44772 8.5 5 8.94772 5 9.5V10.6279C5.87389 10.9368 6.5 11.7703 6.5 12.75C6.5 13.9926 5.49264 15 4.25 15C3.00736 15 2 13.9926 2 12.75C2 11.7703 2.62611 10.9368 3.5 10.6279V5.37207C2.62611 5.06319 2 4.22966 2 3.25C2 2.00736 3.00736 1 4.25 1C5.49264 1 6.5 2.00736 6.5 3.25C6.5 4.22966 5.87389 5.06319 5 5.37207V7.20801C5.30623 7.07421 5.64445 7 6 7H10C10.5523 7 11 6.55228 11 6V5.37207C10.1261 5.06319 9.5 4.22966 9.5 3.25C9.5 2.00736 10.5074 1 11.75 1ZM4.25 12C3.83579 12 3.5 12.3358 3.5 12.75C3.5 13.1642 3.83579 13.5 4.25 13.5C4.66421 13.5 5 13.1642 5 12.75C5 12.3358 4.66421 12 4.25 12ZM4.25 2.5C3.83579 2.5 3.5 2.83579 3.5 3.25C3.5 3.66421 3.83579 4 4.25 4C4.66421 4 5 3.66421 5 3.25C5 2.83579 4.66421 2.5 4.25 2.5ZM11.75 2.5C11.3358 2.5 11 2.83579 11 3.25C11 3.66421 11.3358 4 11.75 4C12.1642 4 12.5 3.66421 12.5 3.25C12.5 2.83579 12.1642 2.5 11.75 2.5Z",fill:"currentColor"}),l[2]=a,l[3]=i,l[4]=s):(a=l[2],i=l[3],s=l[4]),l[5]!==d||l[6]!==u?(o=(0,n.jsxs)("svg",{className:d,xmlns:"http://www.w3.org/2000/svg",width:u,height:u,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",style:a,children:[i,s]}),l[5]=d,l[6]=u,l[7]=o):o=l[7],o},f=e=>{let t,a,i,s,o,l=(0,r.c)(8);l[0]!==e?(t=void 0===e?{}:e,l[0]=e,l[1]=t):t=l[1];let{size:c,className:d}=t,u=void 0===c?16:c;return l[2]===Symbol.for("react.memo_cache_sentinel")?(a={display:"inline-block",verticalAlign:"text-bottom"},i=(0,n.jsx)("path",{d:"M10.3359 0C10.7999 0 11.2452 0.183715 11.5732 0.512695L14.4873 3.42676C14.8163 3.75475 15 4.20008 15 4.66406V8.25098C15 8.66519 14.6642 9.00098 14.25 9.00098C13.8358 9.00098 13.5 8.66519 13.5 8.25098V6H10.75C10.2859 6 9.84088 5.81549 9.5127 5.4873C9.18451 5.15912 9 4.71413 9 4.25V1.5H3.75C3.6837 1.5 3.62013 1.52636 3.57324 1.57324C3.52636 1.62013 3.5 1.6837 3.5 1.75V14.25C3.5 14.388 3.612 14.5 3.75 14.5H7C7.41421 14.5 7.75 14.8358 7.75 15.25C7.75 15.6642 7.41421 16 7 16H3.75C3.28587 16 2.84088 15.8155 2.5127 15.4873C2.18451 15.1591 2 14.7141 2 14.25V1.75C2 0.784 2.784 0 3.75 0H10.3359ZM10.5 4.25C10.5 4.388 10.612 4.5 10.75 4.5H13.4385L13.4268 4.4873L10.5127 1.57324L10.5 1.56152V4.25Z",fill:"currentColor"}),s=(0,n.jsx)("path",{d:"M15.2588 10C15.4577 10.0024 15.6481 10.0833 15.7871 10.2256C15.926 10.3679 16.0023 10.56 16 10.7588C15.9976 10.9577 15.9167 11.1481 15.7744 11.2871L11.2168 15.7363C11.0754 15.874 10.8849 15.9507 10.6875 15.9492C10.4901 15.9476 10.3014 15.8675 10.1621 15.7275L8.21875 13.7783C8.08653 13.6359 8.01476 13.4472 8.01855 13.2529C8.02239 13.0587 8.10162 12.8734 8.23926 12.7363C8.37693 12.5992 8.56253 12.5206 8.75684 12.5176C8.95115 12.5145 9.13933 12.587 9.28125 12.7197L10.7002 14.1445L14.7256 10.2129C14.8679 10.074 15.06 9.99767 15.2588 10Z",fill:"currentColor"}),l[2]=a,l[3]=i,l[4]=s):(a=l[2],i=l[3],s=l[4]),l[5]!==d||l[6]!==u?(o=(0,n.jsxs)("svg",{className:d,xmlns:"http://www.w3.org/2000/svg",width:u,height:u,fill:"none",viewBox:"0 0 16 16","aria-hidden":"true",style:a,children:[i,s]}),l[5]=d,l[6]=u,l[7]=o):o=l[7],o},y={compose:s,dice:o,loops:c,node:i,spaces:l,booleanOn:d,booleanOff:u,input:m,range:h,select:p,gitBranchCheck:g,fileCheck:f};try{i.displayName||(i.displayName="NodeIcon")}catch{}try{s.displayName||(s.displayName="ComposeIcon")}catch{}try{o.displayName||(o.displayName="DiceIcon")}catch{}try{l.displayName||(l.displayName="SpacesIcon")}catch{}try{c.displayName||(c.displayName="LoopsIcon")}catch{}try{d.displayName||(d.displayName="BooleanOnIcon")}catch{}try{u.displayName||(u.displayName="BooleanOffIcon")}catch{}try{m.displayName||(m.displayName="InputIcon")}catch{}try{h.displayName||(h.displayName="RangeIcon")}catch{}try{p.displayName||(p.displayName="SelectIcon")}catch{}try{g.displayName||(g.displayName="GitBranchCheckIcon")}catch{}try{f.displayName||(f.displayName="FileCheckIcon")}catch{}},49936:(e,t,a)=>{a.d(t,{I:()=>n});let n=(0,a(96540).createContext)(null)},51407:(e,t,a)=>{a.d(t,{Y:()=>n});function n(){let e={};return e.promise=new Promise((t,a)=>{e.resolve=t,e.reject=a}),e}},51563:(e,t,a)=>{a.d(t,{$:()=>d});var n=a(33592),r=a(23657),i=a(72011),s=a(97665),o=a(94747),l=a(96379),c=a(31971);let d=e=>{let t=(0,n.b)(),a=(0,s.jE)(),{mutateAsync:d,...u}=(0,o.n)({onSuccess:async()=>{a.invalidateQueries({queryKey:i.O6}),e&&await a.invalidateQueries({queryKey:(0,i.dp)(e)})},mutationFn:async a=>{let n=e?(0,r.fn)(e):"/custom_copilots",i={custom_copilot:{owner_id:a.ownerId,owner_type:a.ownerType,name:a.name,icon_type:a.iconType,icon_color:a.iconColor,description:a.description,general_instructions:a.generalInstructions,resources_attributes:a.resources?.map(e=>({id:e.databaseId,copilot_chat_attachment_id:e.copilotChatAttachmentId,resource_type:e.type,_destroy:e.markedForDestroy,metadata:(0,c.M)(e)})),visibility:a.visibility,base_role:a.baseRole}},s=await (0,l.lS)(n,{method:e?"PUT":"POST",body:i}),o=await s.json();if(!s.ok)throw o.errorMessages;return t?.dispatch({type:"SET_CUSTOM_COPILOT",customCopilot:o}),o}});return{upsertCopilotSpace:d,...u}}},53627:(e,t,a)=>{a.d(t,{C3:()=>o,JV:()=>r,K3:()=>u,MM:()=>l,OE:()=>m,Zu:()=>d,bj:()=>i,jc:()=>c,kd:()=>s});var n=a(71315);function r(){return n.Kn?.state||{}}function i(e){h(r(),"",e)}function s(e){n.Kn?.pushState({appId:r().appId},"",e),p()}function o(e){h({...r(),...e},"",location.href)}function l(e){i(`?${e.toString()}${n.fV.hash}`)}function c(){i(n.fV.pathname+n.fV.hash)}function d(e){i(e.startsWith("#")?e:`#${e}`)}function u(){i(n.fV.pathname+n.fV.search)}function m(){n.Kn?.back()}function h(e,t,a){n.Kn?.replaceState(e,t,a),p()}function p(){n.cg?.dispatchEvent(new CustomEvent("statechange",{bubbles:!1,cancelable:!1}))}},54114:(e,t,a)=>{a.d(t,{Rw:()=>T});var n=a(74848),r=a(6665),i=a(19189),s=a(25556),o=a(34535),l=a(96459),c=a(38621),d=a(40480),u=a(46720),m=a(69726),h=a(87448),p=a(10095),g=a(96540),f=a(96379),y=a(52870);function x(e,t,a){let n=[];for(let r of t)if(r.startsWith(e)){let t=r.slice(e.length+1),i=t.indexOf("/"),s=i>0?t.slice(0,i):t,o=`${e}/${s}`;if(a&&a.some(e=>e.path===o))continue;let l={items:[],data:{contentType:o===r?"file":"directory",name:s,path:o,isClientOnly:!0}};n.push(l)}return n}let v={checkbox:"FileTreePicker-module__checkbox--uY6AK",itemContainer:"FileTreePicker-module__itemContainer--ShYuv",Box:"FileTreePicker-module__Box--RKQKr",Box_1:"FileTreePicker-module__Box_1--usRNW",Octicon:"FileTreePicker-module__Octicon--rINlU",Box_2:"FileTreePicker-module__Box_2--yFodr"};var C=a(53419);function _(e,t){let a=new Set(e);switch(t.type){case"SINGLE_SELECT_FILE":a.clear(),a.add(t.path),(0,C.BI)("copilot-spaces.click",{target:"FILE_PICKER",action:"SINGLE_SELECT_FILE",newFileCount:a.size});break;case"SELECT_FILE":a.add(t.path),(0,C.BI)("copilot-spaces.click",{target:"FILE_PICKER",action:"SELECT_FILE",newFileCount:a.size});break;case"DESELECT_FILE":a.delete(t.path),(0,C.BI)("copilot-spaces.click",{target:"FILE_PICKER",action:"DESELECT_FILE",newFileCount:a.size});break;case"SELECT_DIRECTORY":for(let e of t.paths)a.add(e);(0,C.BI)("copilot-spaces.click",{target:"FILE_PICKER",action:"SELECT_DIRECTORY",newFileCount:a.size,directoryCount:t.paths.length});break;case"DESELECT_DIRECTORY":for(let e of t.paths)a.delete(e);(0,C.BI)("copilot-spaces.click",{target:"FILE_PICKER",action:"DESELECT_DIRECTORY",newFileCount:a.size,directoryCount:t.paths.length})}return a}function S({isActive:e,file:t,onItemSelected:a,getItemUrl:i,selectedItemRef:l,navigate:m,onRenderRow:h,getFileTrailingVisual:p,getFileIcon:f,navigateOnClick:y,isSelected:x,singleSelect:C}){let{sendRepoClickEvent:_}=(0,r.T)(),S=g.useRef(null),b=(0,o.Z)({focusRowRef:S,mouseRowRef:S}),j="submodule"===t.data.contentType,w=p?.(t.data);(0,g.useEffect)(()=>{e&&S.current&&requestAnimationFrame(()=>{S.current?.scrollIntoView({block:"center"})})},[e]);let N=g.useCallback(e=>{j?(e.preventDefault(),t.data.submoduleUrl&&(window.location.href=t.data.submoduleUrl)):e.metaKey||e.ctrlKey||1===e.button?(window.open(i?.(t.data),"_blank"),e.preventDefault()):(a?.(t.data,t),_("FILES_TREE.ITEM",{item_path:t.data.path}),y&&m(i?.(t.data)||""),e.stopPropagation())},[t,i,j,m,y,a,_]);return h?.(),(0,n.jsxs)(d.G.Item,{ref:S,onSelect:N,current:e,id:`${t.data.path}-item`,containIntrinsicSize:e?void 0:"auto 2rem",children:[(0,n.jsx)(d.G.LeadingVisual,{children:f?f(t.data):j?(0,n.jsx)(c.FileSubmoduleIcon,{}):(0,n.jsx)(c.FileIcon,{})}),(0,n.jsxs)("div",{className:v.itemContainer,children:[!C&&(0,n.jsx)(u.A,{className:v.checkbox,checked:x||!1,readOnly:!0,"aria-label":`Select ${t.data.name}`}),(0,n.jsx)("span",{ref:l,style:{color:j?"var(--fgColor-accent, var(--color-accent-fg))":void 0},children:(0,n.jsx)("span",{"data-testid":`${t.data.path}-file-item`,children:t.data.name})})]}),b&&(0,n.jsx)(s.m,{"data-testid":`${t.data.name}-item-tooltip`,id:`${t.data.name}-item-tooltip`,contentRef:S,"aria-label":t.data.name,open:!0,direction:"ne"}),!!w?.screenReaderText&&(0,n.jsx)("span",{className:"sr-only",children:w.screenReaderText}),!!w?.trailingVisual&&(0,n.jsx)(d.G.TrailingVisual,{children:w.trailingVisual})]})}let b=g.memo(S),j=g.memo(u.A);function w({clientOnlyFilePaths:e,directory:t,isActive:a,isAncestorOfActive:i,leadingPath:l,onItemSelected:c,getItemUrl:u,getFetchUrl:m,selectedItemRef:h,navigate:p,onRenderRow:C,getFileTrailingVisual:_,getFileIcon:S,navigateOnClick:b,selectedChildren:w,expandedPath:N,singleSelect:I}){let[T,R]=(0,g.useState)(i),{sendRepoClickEvent:k}=(0,r.T)(),L=g.useRef(null),P=g.useRef(null),M=(0,o.Z)({focusRowRef:P,mouseRowRef:L}),O=g.useMemo(()=>w?.filter(e=>e.startsWith(`${t.data.path}/`)),[w,t.data.path]),D=g.useMemo(()=>w?.includes(t.data.path)??!1,[w,t.data.path]),F=t.items.length>1e3,B=g.useMemo(()=>(function(e,t,a){if(a?.selectedSelf&&a?.isLarge)return"all";if(!t||0===t.length)return"none";let n=`${e.data.path}/`,r=e.items.length,i=t.filter(e=>e.startsWith(n)&&!e.slice(n.length).includes("/")).length;return 0===i?"none":i>=r?"all":"partial"})(t,O,{selectedSelf:D,isLarge:F}),[t,O,D,F]),[$,z,U,W,V,H,q]=function(e,t,a){let[n,r]=g.useState(e.items),[i,s]=g.useState(e.data.totalCount||0),[o,l]=g.useState(!1),[c,d]=g.useState(!1),{safeSetTimeout:u}=(0,y.A)();g.useEffect(()=>{r(e.items)},[e.items]),g.useEffect(()=>{void 0!==e.data.totalCount&&s(e.data.totalCount)},[e.data.totalCount]);let m=g.useCallback(()=>{d(!1)},[]),h=g.useCallback((e,t)=>{let a=e||[...n];r(a.slice(0,100)),u(()=>{r(a),void 0!==t&&s(t)},1)},[n,u]);return[g.useCallback(async n=>{let i=new Map;if(e.data.isClientOnly){if(n){let a=x(e.data.path,n);for(let e of a)i.set(e.data.path,e);t({type:"add",folders:i,processingTime:0}),a.length>100?h(a,a.length):(r(a),s(a.length))}}else{let o=a(e.data);d(!1),l(!0);let c=Date.now(),u=await (0,f.lS)(`${o}?noancestors=1`);try{if(u.ok){let a=await u.json(),o=a.payload.tree.items.map(e=>{let t={items:[],data:{...e},autoExpand:"directory"===e.contentType&&1===a.payload.tree.items.length};return(i.set(e.path,t),e.hasSimplifiedPath)?function e(t,a,n){t.data.name=t.data.name.slice(t.data.name.lastIndexOf("/")+1,t.data.name.length);let r=a.name.slice(0,a.name.lastIndexOf("/")),i=r.indexOf("/")>-1,s={path:a.path.slice(0,a.path.lastIndexOf("/")),contentType:a.contentType,name:r,hasSimplifiedPath:i},o={items:[t],data:s};return(n.set(s.path,o),i)?e(o,{...s},n):o}(t,e,i):t});if(n){let t=e.data.path,r=x(t,n,a.payload.tree.items);for(let e of(o.push(...r),r))i.set(e.data.path,e)}t({type:"add",folders:i,processingTime:Date.now()-c}),e.items=o,e.data.totalCount=a.payload.tree.totalCount,o.length>100?h(o,a.payload.tree.totalCount):(r(o),s(a.payload.tree.totalCount))}else d(!0)}catch{d(!0)}}l(!1)},[a,e,t,h]),h,n,o,c,m,i]}(t,()=>{},m),K=l?`${l}/`:"",G=q-U.length;(0,g.useEffect)(()=>{a&&L.current&&requestAnimationFrame(()=>{L.current?.scrollIntoView({block:"center"})})},[a]);let Q=g.useCallback(e=>{!e||T||W||V||!(t.items.length>100)||z(),e!==T&&R(e)},[T,W,V,t.items.length,z]),Z=g.useCallback(e=>{e.metaKey||e.ctrlKey||1===e.button&&b?(window.open(u?.(t.data),"_blank"),e.preventDefault()):(I?Q(!T):(c?.(t.data,t),k("FILES_TREE.ITEM",{item_path:t.data.path}),b&&p(u?.(t.data)||"")),e.stopPropagation())},[t,u,T,p,b,c,Q,k,I]);g.useEffect(()=>{i&&!T&&Q?.(!0)},[i]),g.useEffect(()=>{0===t.items.length&&T?Q?.(!1):!T&&t.autoExpand&&Q?.(!0)},[t.items.length]);let J=g.useCallback(e=>{h&&a&&h(e),L.current=e},[h,a]);if(1===t.items.length){let r=t.items[0];if(r&&"directory"===r.data.contentType)return(0,n.jsx)(E,{clientOnlyFilePaths:e,directoryItems:t.items,leadingPath:K+t.data.name,inheritsActive:a,onItemSelected:c,selectedItemRef:h,getItemUrl:u,directoryNavigateOnClick:b,navigateOnClick:b,getFileTrailingVisual:_,getFileIcon:S,selectedChildren:O,expandedPath:N,singleSelect:I})}return C?.(),(0,n.jsxs)(d.G.Item,{ref:P,expanded:T,onExpandedChange:Q,current:a,onSelect:Z,id:`${t.data.path}-item`,containIntrinsicSize:a?void 0:"auto 2rem",children:[(0,n.jsx)(d.G.LeadingVisual,{children:(0,n.jsx)(d.G.DirectoryIcon,{})}),(0,n.jsxs)("div",{className:v.itemContainer,children:[!I&&(0,n.jsx)(j,{className:v.checkbox,checked:"all"===B,indeterminate:"partial"===B,readOnly:!0,"aria-label":`Select ${t.data.name}`,"data-indeterminate":"partial"===B?"true":void 0}),(0,n.jsxs)("span",{ref:J,children:[K&&(0,n.jsx)("span",{children:K}),(0,n.jsx)("span",{"data-testid":`${t.data.path}-directory-item`,children:t.data.name})]})]}),M&&(0,n.jsx)(s.m,{"data-testid":`${t.data.name}-directory-item-tooltip`,id:`${t.data.name}-directory-item-tooltip`,contentRef:P,"aria-label":`${K}${t.data.name}`,open:!0,direction:"ne"}),(0,n.jsx)(d.G.SubTree,{state:W?"loading":V?"error":"done",children:V?(0,n.jsx)(d.G.ErrorDialog,{onRetry:$,onDismiss:H,children:"There was an error loading the folder contents."}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E,{clientOnlyFilePaths:e,directoryItems:U,onItemSelected:c,selectedItemRef:h,getItemUrl:u,directoryNavigateOnClick:b,navigateOnClick:b,getFileTrailingVisual:_,getFileIcon:S,selectedChildren:O,expandedPath:N,singleSelect:I}),G>0&&(0,n.jsx)(A,{message:`${G} entries not shown`})]})})]})}let N=g.memo(w,(e,t)=>e.isActive===t.isActive&&e.isAncestorOfActive===t.isAncestorOfActive&&e.directory===t.directory&&(e.selectedChildren===t.selectedChildren||0===e.selectedChildren.length&&0===t.selectedChildren.length)&&e.expandedPath===t.expandedPath);function I({clientOnlyFilePaths:e,directoryItems:t,leadingPath:a,inheritsActive:r,onItemSelected:s,selectedItemRef:o,onRenderRow:c,getItemUrl:d,getFileTrailingVisual:u,getFileIcon:m,directoryNavigateOnClick:h,navigateOnClick:p,selectedChildren:f,expandedPath:y,singleSelect:x}){let v=(0,i.Z)(),C=(0,l.Z)(),_=g.useRef(C),S=g.useRef(s);g.useEffect(()=>{S.current=s,_.current=C},[s,C]);let j=g.useCallback((e,t)=>{S.current?.(e,t)},[]),w=g.useMemo(()=>t.map(t=>{let i=y===t.data.path,s=f?.includes(t.data.path),l=i||y.startsWith(`${t.data.path}/`),g=f?.filter(e=>e===t.data.path||e.startsWith(`${t.data.path}/`));return"directory"===t.data.contentType?(0,n.jsx)(N,{clientOnlyFilePaths:e,isActive:r||i,isAncestorOfActive:l,onItemSelected:j,leadingPath:a,directory:t,getItemUrl:d,getFetchUrl:v.getItemUrl,selectedItemRef:l?o:void 0,navigate:C,onRenderRow:c,navigateOnClick:h,getFileTrailingVisual:u,getFileIcon:m,itemCount:t.items.length,isSelected:s,selectedChildren:g,expandedPath:y,singleSelect:x},t.data.name):(0,n.jsx)(b,{onItemSelected:j,file:t,isActive:i,getItemUrl:d,selectedItemRef:i?o:void 0,navigate:C,navigateOnClick:p,onRenderRow:c,getFileTrailingVisual:u,getFileIcon:m,isSelected:s,singleSelect:x},t.data.name)}),[t,y,f,j,d,o,C,p,c,u,m,x,e,r,a,v.getItemUrl,h]);return(0,n.jsx)(n.Fragment,{children:w})}let E=g.memo(I);function T(e){let{clientOnlyFilePaths:t,rootItems:a,fetchError:r,loading:i,onRenderRow:s,getItemUrl:o,getFileTrailingVisual:l,getFileIcon:c,expandedPath:u,onSelectionChange:p}=e,[f,y]=(0,g.useReducer)(_,new Set),x=e.selectedItems||f,C=(0,g.useCallback)(e=>{let t=new Set;if(t.add(e.data.path),"directory"===e.data.contentType)for(let a of e.items)for(let e of C(a))t.add(e);return Array.from(t)},[]),S=(0,g.useCallback)((t,a)=>{var n;let r=(n=!!e.singleSelect,n?{type:"SINGLE_SELECT_FILE",path:t}:a?{type:"DESELECT_FILE",path:t}:{type:"SELECT_FILE",path:t});p?p(_(x,r)):y(r)},[p,e.singleSelect,x]),b=(0,g.useCallback)((t,a)=>{if(e.allowFolderReferences&&t.items.length>1e3){let e=t.data.path,a=x.has(e)?{type:"DESELECT_FILE",path:e}:{type:"SELECT_FILE",path:e};p?p(_(x,a)):y(a);return}let n=C(t),r=a?{type:"DESELECT_DIRECTORY",paths:n}:{type:"SELECT_DIRECTORY",paths:n};p?p(_(x,r)):y(r)},[C,p,x,e.allowFolderReferences]),j=(0,g.useCallback)((t,a)=>{if("directory"===t.contentType){if(e.allowFolderReferences&&a.items.length>1e3)return void b(a,x.has(t.path));let n=C(a).every(e=>x.has(e));b(a,n)}else S(t.path,x.has(t.path))},[C,b,S,x,e.allowFolderReferences]),w=(0,g.useCallback)(e=>{1===e.button&&e.preventDefault()},[]);return(0,n.jsx)(h.az,{onMouseDown:w,sx:{...e.sx},"data-testid":"repos-file-tree-container",className:v.Box,children:i?(0,n.jsxs)("div",{className:v.Box_1,children:[(0,n.jsx)(m.A,{"aria-label":"Loading file tree"}),(0,n.jsx)("span",{className:"fgColor-muted",children:"Fetching files..."})]}):(0,n.jsx)("nav",{"aria-label":"File Tree Navigation",children:(0,n.jsxs)(d.G,{"aria-label":"Files",children:[r&&(0,n.jsx)(A,{message:"Some files could not be loaded."}),(0,n.jsx)(E,{clientOnlyFilePaths:t,directoryItems:a,onItemSelected:j,selectedChildren:x?Array.from(x):[],selectedItemRef:e.selectedItemRef,onRenderRow:s,directoryNavigateOnClick:e.directoryNavigateOnClick,navigateOnClick:e.navigateOnClick,getItemUrl:o,getFileTrailingVisual:l,getFileIcon:c,expandedPath:u,singleSelect:e.singleSelect})]})})})}function A({message:e}){return(0,n.jsxs)(d.G.Item,{id:"error-tree-row",children:[(0,n.jsx)(d.G.LeadingVisual,{children:(0,n.jsx)(p.A,{icon:c.AlertFillIcon,className:v.Octicon})}),(0,n.jsx)("div",{className:v.Box_2,children:e||"Couldn't load."})]})}try{S.displayName||(S.displayName="WrappedFileTreeRow")}catch{}try{b.displayName||(b.displayName="FileTreeRow")}catch{}try{j.displayName||(j.displayName="MemoizedCheckbox")}catch{}try{w.displayName||(w.displayName="WrappedDirectoryTreeRow")}catch{}try{N.displayName||(N.displayName="DirectoryTreeRow")}catch{}try{I.displayName||(I.displayName="WrappedDirectoryContents")}catch{}try{E.displayName||(E.displayName="DirectoryContents")}catch{}try{T.displayName||(T.displayName="FileTreePicker")}catch{}try{A.displayName||(A.displayName="ErrorTreeRow")}catch{}},56708:(e,t,a)=>{a.d(t,{q:()=>ChatInputValidationError});let ChatInputValidationError=class ChatInputValidationError extends Error{constructor(e){super(e),this.name="ChatInputValidationError"}}},57224:(e,t,a)=>{a.d(t,{y:()=>s});var n=a(74848),r=a(21728),i=a(49936);function s(e){let t,a,s=(0,r.c)(7),{children:o,appName:l,category:c,metadata:d}=e;s[0]!==l||s[1]!==c||s[2]!==d?(t={appName:l,category:c,metadata:d},s[0]=l,s[1]=c,s[2]=d,s[3]=t):t=s[3];let u=t;return s[4]!==o||s[5]!==u?(a=(0,n.jsx)(i.I.Provider,{value:u,children:o}),s[4]=o,s[5]=u,s[6]=a):a=s[6],a}try{s.displayName||(s.displayName="AnalyticsProvider")}catch{}},57448:(e,t,a)=>{a.d(t,{Ld:()=>g,M8:()=>f,Tz:()=>v,W5:()=>u,cx:()=>p,r_:()=>x,vn:()=>y,xG:()=>m});var n=a(51987),r=a(97665),i=a(40458),s=a(94747),o=a(97286),l=a(96379),c=a(96540),d=a(79064);a(2635),a(33592);let u={Unindexed:"not_indexed",Indexed:"indexed",Indexing:"indexing",PartiallyIndexed:"partially_indexed",Unknown:"unknown"},m={Requested:"requested",NotFound:"not_found",Unauthorized:"unauthorized",ServiceUnavailable:"service_unavailable",QuotaExhausted:"quota_exhausted",Forbidden:"forbidden",CanIndex:"ok",IndexingError:"indexing_error",RequestFailed:"request_failed",Unknown:"unknown"},h=[m.NotFound,m.Unauthorized,m.ServiceUnavailable,m.QuotaExhausted,m.Forbidden,m.RequestFailed],p=256,g=400;function f(e){var t,a;let n=(0,r.jE)(),o=(0,c.useCallback)(()=>Promise.all(e.map(e=>n.invalidateQueries({queryKey:["copilot-chat","repos-indexing-state",e]}))),[n,e]),l=(0,i.E)({queries:e.map(e=>({queryKey:["copilot-chat","repos-indexing-state",e],queryFn:()=>C(e),placeholderData:{requestStatus:m.Unknown,code:u.Unknown,docs:u.Unknown},staleTime:1/0}))}),{mutate:d}=(0,s.n)({mutationKey:["repos-indexing-state"],mutationFn:()=>_(e),onSuccess:o}),p={requestStatus:0===(a=(t=l.map(e=>e.data)).map(e=>e.requestStatus)).length?m.Unknown:a.some(e=>h.includes(e))?m.IndexingError:a.every(e=>e===m.CanIndex)?m.CanIndex:(a.every(e=>e===m.Unknown),m.Unknown),code:b(t.map(e=>e.code)),docs:b(t.map(e=>e.docs)),remainingRepoIndexTokens:t[0]?.remainingRepoIndexTokens};return j(()=>void o(),1e4*(p.code===u.Indexing&&p.requestStatus!==m.IndexingError)),[p,()=>d()]}function y(e){let t=(0,r.jE)(),a=(0,c.useCallback)(()=>Promise.resolve(t.invalidateQueries({queryKey:["repo-indexing-state",e]})),[t,e]),n=(0,o.I)({queryKey:["copilot-chat","repo-indexing-state",e],queryFn:()=>C(e),placeholderData:{requestStatus:m.Unknown,code:u.Unknown,docs:u.Unknown},staleTime:1/0}),{mutate:i}=(0,s.n)({mutationKey:["repo-indexing-state"],mutationFn:()=>_([e]),onSuccess:a}),l=n.data;return j(()=>void a(),1e4*(l.code===u.Indexing&&l.requestStatus!==m.IndexingError)),[l,()=>i()]}function x(e){let t=(0,o.I)({queryKey:["copilot-chat","repos-indexing-state",e],queryFn:()=>S(e),staleTime:1/0});return!t.isError&&!!t.data?.canChat}function v(){let e=d.Jt.getPanelHeight(),t=d.Jt.getPanelWidth(),a=(0,c.useRef)(null),n=(0,c.useRef)(e),r=(0,c.useRef)(e),i=(0,c.useRef)(null),s=(0,c.useRef)(t),o=(0,c.useRef)(t),[l,u]=(0,c.useState)(e),[m,h]=(0,c.useState)(t),f=(0,c.useRef)(0);(0,c.useEffect)(()=>{f.current=parseFloat(getComputedStyle(document.documentElement).fontSize)},[]);let y=e=>Math.min(Math.max(e,p),window.innerHeight-f.current),x=e=>Math.min(Math.max(e,g),window.innerWidth-2*f.current),v=(0,c.useCallback)(e=>{if(null!==a.current){let t=a.current-e.clientY,i=y(n.current+t);u(i),r.current=i}if(null!==i.current){let t=i.current-e.clientX,a=x(s.current+t);h(a),o.current=a}},[]),C=(0,c.useCallback)(()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",C),null!==a.current&&(d.Jt.setPanelHeight(r.current),a.current=null),null!==i.current&&(d.Jt.setPanelWidth(o.current),i.current=null)},[v]),_=(0,c.useCallback)((e,t,r)=>{0===e.button&&(e.preventDefault(),r&&(a.current=e.clientY,n.current=l),t&&(i.current=e.clientX,s.current=m),window.addEventListener("mousemove",v),window.addEventListener("mouseup",C))},[l,m,v,C]),S=(0,c.useCallback)(e=>{if("ArrowUp"===e.key){let t=y(l+4);u(t),d.Jt.setPanelHeight(t),e.preventDefault()}else if("ArrowDown"===e.key){let t=y(l-4);u(t),d.Jt.setPanelHeight(t),e.preventDefault()}else if("ArrowRight"===e.key){let t=x(m-4);h(t),d.Jt.setPanelWidth(t),e.preventDefault()}else if("ArrowLeft"===e.key){let t=x(m+4);h(t),d.Jt.setPanelWidth(t),e.preventDefault()}},[l,m]);return{panelWidth:m,panelHeight:l,startResize:_,onResizerKeyDown:S}}async function C(e){let t=await fetch(`/search/check_indexing_status?nwo=${encodeURIComponent(e)}`,{headers:{Accept:"application/json",...(0,n.kt)()}});if(!t.ok)return{requestStatus:m.RequestFailed,code:u.Unknown,docs:u.Unknown};let a=await t.json();return{requestStatus:a.can_index,code:a.code_status,docs:a.docs_status}}async function _(e){let t=1===e.length?`nwo=${encodeURIComponent(e[0])}`:`nwos=${encodeURIComponent(JSON.stringify(e))}`;return(0,l.DI)(`/search/index_embeddings?${t}&index_code=true`,{method:"POST"})}async function S(e){let t=await fetch(`/github-copilot/docs/docsets/kb_indexed_repos?ids=${encodeURIComponent(JSON.stringify(e))}`,{headers:{Accept:"application/json",...(0,n.kt)()}});return t.ok?await t.json():{canChat:!1}}function b(e){return e.every(e=>e===u.Indexed)?u.Indexed:e.every(e=>e===u.Unindexed)?u.Unindexed:e.some(e=>e===u.Indexing)?u.Indexing:e.some(e=>e===u.Unindexed)?u.PartiallyIndexed:u.Unknown}function j(e,t){let a=(0,c.useRef)(void 0),n=(0,c.useRef)(e);return(0,c.useEffect)(()=>{n.current=e},[e]),(0,c.useEffect)(()=>{if(t>0)return a.current=window.setInterval(()=>n.current(),t),()=>window.clearInterval(a.current)},[t]),a}},60905:(e,t,a)=>{a.d(t,{s:()=>CopilotImageAttacher});var n=a(50467),r=a(53419),i=a(25641),s=a(35247),o=a(76166),l=a(30456);let c=["image/gif","image/jpeg","image/png","image/webp"];let CopilotImageAttacher=class CopilotImageAttacher{static getAllowedImageFileExtensions(e){return this.getFileExtensions(e).join(",")}static isTypeAllowed(e,t){return e=e.toLowerCase(),this.getMimeTypes(t).includes(e)}static getAllowedFiles(e,t){let[a,n]=e.reduce(([e,a],n)=>this.isTypeAllowed(n.type,t)?[[...e,n],a]:[e,[...a,n]],[[],[]]);return[a,n]}static getAttachmentLimit(){return s.W.attachMultipleImages?4:1}static getAttachmentSizeLimit(){return 3932160}static makeImageReference(e,t){let a=crypto.randomUUID(),n=new l.N(a,e,t);return{id:a,attachment:n,type:"image",name:e.name||"Image"}}static getFileExtensions(e){if(Array.isArray(e))return Array.from(new Set(e.flatMap(e=>this.getFileExtensions(e))));let t=this.getMimeTypes(e).map(e=>`.${e.split("/")[1]}`);return t.includes(".jpeg")&&t.push(".jpg"),t}static getMimeTypes(e){return Array.isArray(e)?Array.from(new Set(e.flatMap(e=>this.getMimeTypes(e)))):e.capabilities.limits.vision?e.capabilities.limits.vision.supported_media_types.filter(e=>c.includes(e)):[]}async addImageAttachments(e,t="unknown",a,n=!1){if(0===e.length)return[];let l=null,c=this.state.selectedThreadID,d=this.manager.getPendingThreadId(a),u=s.W.visionSkipThreadCreate;if(a&&!c&&d&&(c=d),!c&&!u)try{c=(l=await this.manager.createThread({customCopilotId:a,preventThreadSelection:n})).id}catch(t){let e="An error occurred creating the thread. Sending a single message should create a new thread.";throw t instanceof Error&&(e||(e=t.message)),this.manager.addAmbientError(e),Error(e)}let m=this.state.currentReferences.filter(e=>"image"===e.type).length,h=CopilotImageAttacher.getAttachmentLimit();if(m+e.length>h){let e=s.W.attachMultipleImages?`You can add up to ${h} image files per message.`:"Only one image can be uploaded at a time";return this.manager.addAmbientError(e),(0,o.d)("file_limit_reached"),[]}let p=[],g=[];for(let a of e){if(!CopilotImageAttacher.isTypeAllowed(a.type,this.state.model))return(0,o.d)("included_unsupported_file",{fileTypes:a.type,uploadType:t}),[];if(a.size>CopilotImageAttacher.getAttachmentSizeLimit())return this.manager.addAmbientError("Only images below 3.75MB are supported"),(0,o.d)("size_limit_exceeded",{size:a.size}),[];if(null==c&&!u)throw this.manager.addAmbientError("Please manually create a thread before uploading an image"),Error("ThreadID resolution for image attachment is not functioning properly");let e=CopilotImageAttacher.makeImageReference(a,c);if(this.state.model.id.startsWith("claude")&&this.state.model.capabilities.supports.vision){let t=await e.attachment.getDimensions();if(t.width&&t.height&&(t.width>8e3||t.height>8e3)){this.manager.addAmbientError("The image you uploaded exceeds the maximum allowed dimensions for Claude models. Please try again with another model."),(0,o.d)("dimension_limit_exceeded",{width:t.width,height:t.height});continue}}let n=(0,i.Vc)(a.name);this.manager.addReference(n,"image-attacher"),0===g.length&&this.manager.dispatch({type:"WAITING_ON_ATTACHMENT",loading:!0,attachmentType:"file-upload"}),g.push({file:a,placeholder:n,reference:e})}return await Promise.all(g.map(async({file:e,placeholder:a,reference:n})=>{try{l&&await n.attachment.prefetch(),this.manager.setImageAttachmentUploaded(n.id,n.attachment),this.manager.replaceReference(a,n),(0,r.BI)("dotcom_chat.vision.image_added",{uploadType:t}),p.push(n)}catch(n){this.manager.removeReference(a);let t="An unexpected error occurred while reading the file";if("string"==typeof n)throw this.manager.addAmbientError(`An error occurred uploading the attachment ${e.name}`),(0,o.d)("ErrorString",{message:n}),Error(n);if(n instanceof Error)if((0,o.d)(n.name,{message:n.message}),"GenericServerError"===n.name&&n.message.includes("Error creating policy"))this.manager.addAmbientError(t);else throw this.manager.addAmbientError(t),n;else throw this.manager.addAmbientError(t),n}})).finally(()=>{this.manager.dispatch({type:"WAITING_ON_ATTACHMENT",loading:!1})}),n&&a&&l&&this.manager.setPendingThreadId(l.id,a),p}constructor(e,t){(0,n._)(this,"state",void 0),(0,n._)(this,"manager",void 0),this.state=e,this.manager=t}}},61180:(e,t,a)=>{a.d(t,{T:()=>s});var n=a(21728),r=a(96540),i=a(79064);function s(){let e,t,a=(0,n.c)(3),[s,l]=(0,r.useState)(o);a[0]===Symbol.for("react.memo_cache_sentinel")?(e=e=>{l(e),e&&i.Jt.setLastUsedRepository(e)},a[0]=e):e=a[0];let c=e;return a[1]!==s?(t=[s,c],a[1]=s,a[2]=t):t=a[2],t}function o(){return i.Jt.getLastUsedRepository()}},62227:(e,t,a)=>{a.d(t,{A:()=>n});let n={Box:"SingleSignOnBanner-module__Box--jDDJV",Flash:"SingleSignOnBanner-module__Flash--OYpTa",Box_1:"SingleSignOnBanner-module__Box_1--f7GQK",Octicon:"SingleSignOnBanner-module__Octicon--Mg3jx",Box_2:"SingleSignOnBanner-module__Box_2--Se3Ze",ForceWrap:"SingleSignOnBanner-module__ForceWrap--Vz1Sn",Paragraph:"SingleSignOnBanner-module__Paragraph--jaDvQ",ProtectedOrgs_FullList:"SingleSignOnBanner-module__ProtectedOrgs_FullList--siZfg",ProtectedOrgs_Shortened:"SingleSignOnBanner-module__ProtectedOrgs_Shortened--G8LoG",ShieldLockIcon:"SingleSignOnBanner-module__ShieldLockIcon--k2b_L"}},63422:(e,t,a)=>{a.d(t,{L:()=>c});var n=a(74848),r=a(21728),i=a(26108),s=a(34164),o=a(96540);let l={anchor:"IconButtonSelector-module__anchor--t8Bzw"},c=(0,o.forwardRef)((e,t)=>{let a,o,c,d,u,m,h=(0,r.c)(11);h[0]!==e?({selected:d,icon:a,selectedIcon:o,...c}=e,h[0]=e,h[1]=a,h[2]=o,h[3]=c,h[4]=d):(a=h[1],o=h[2],c=h[3],d=h[4]);let p=d&&o?o:a;return h[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.$)(l.anchor),h[5]=u):u=h[5],h[6]!==p||h[7]!==t||h[8]!==c||h[9]!==d?(m=(0,n.jsx)(i.K,{ref:t,...c,className:u,icon:p,"data-selected":d}),h[6]=p,h[7]=t,h[8]=c,h[9]=d,h[10]=m):m=h[10],m});c.displayName="IconButtonSelector"},65432:(e,t,a)=>{a.d(t,{Bu:()=>p,SC:()=>c,Ti:()=>m,iS:()=>d,k5:()=>l,o4:()=>u,rZ:()=>h});var n=a(82591),r=a(73900),i=a(15838),s=a(94416);let o=0;function l(){o=0,document.dispatchEvent(new Event(n.z.INITIAL)),(0,s.xT)()}function c(e){(0,s.LM)()||(document.dispatchEvent(new Event(n.z.PROGRESS_BAR.START)),document.dispatchEvent(new r.sW(e)),(0,s.Vy)(e),(0,s.ZW)(),(0,s.HK)(),(0,i.E5)())}function d(e={}){f(e)&&(o+=1,document.dispatchEvent(new r.ni((0,s.di)(),o)),m(e))}function u(e={}){if(!f(e))return;o=0;let t=(0,s.my)()||s.BW;document.dispatchEvent(new r.Kq((0,s.di)(),t)),g(),(0,i.Cd)(t),(0,s.xT)()}function m(e={}){if(!f(e))return;let t=(0,s.di)();g(),document.dispatchEvent(new r.RQ(t)),(0,s.Ff)(),(0,s.JA)(t)}function h(e={}){f(e)&&((0,i.Im)(),document.dispatchEvent(new Event(n.z.RENDER)))}function p(){document.dispatchEvent(new Event(n.z.FRAME_UPDATE))}function g(){document.dispatchEvent(new Event(n.z.PROGRESS_BAR.END))}function f({skipIfGoingToReactApp:e,allowedMechanisms:t=[]}={}){return(0,s.LM)()&&(0===t.length||t.includes((0,s.di)()))&&(!e||!(0,s.gc)())}},70257:(e,t,a)=>{a.d(t,{V:()=>t2});var n,r=a(74848),i=a(21728),s=a(53419),o=a(88934),l=a(94236),c=a(46251),d=a(69726),u=a(5524),m=a(96540),h=a(82595),p=a(84646),g=a(2635),f=a(79802);function y(){let{threads:e}=(0,g.Pk)(),t=Array.from(e.values()).sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>(0,f.O)(e)).filter(e=>null!==e),a=(0,p.jS)(!0),{data:n}=a;if(void 0===n)return a;let r=new Set,i=[...t.map(e=>n.find(t=>e.id===t.id&&e.owner===t.owner)).filter(e=>{if(void 0===e)return!1;let t=`${e.owner}:${e.id}`;return!r.has(t)&&(r.add(t),!0)}),...[...n].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).filter(e=>{let t=`${e.owner}:${e.id}`;return!r.has(t)})].slice(0,5);return{...a,data:i}}var x=a(17485),v=a(25641),C=a(34164);let _={toggleButton:"ToggleButton-module__toggleButton--JlWKX",selected:"ToggleButton-module__selected--fx0LM",icon:"ToggleButton-module__icon--mJLXC",textContent:"ToggleButton-module__textContent--xX6cl"},S=(0,m.forwardRef)((e,t)=>{let a,n,s,o,l,c,d,u,m,h,p,g,f,y,x,v,S=(0,i.c)(33);if(S[0]!==e){let{icon:t,isSelected:r,onClick:i,hasMenu:m,isMenuOpen:h,selectedItemLabel:p,children:g,...f}=e;s=t,c=i,d=p,a=g,l=void 0!==r&&r,n=void 0!==m&&m,o=void 0!==h&&h,u=Object.keys(f).reduce((e,t)=>(t.startsWith("aria-")&&(e[t]=f[t]),e),{}),S[0]=e,S[1]=a,S[2]=n,S[3]=s,S[4]=o,S[5]=l,S[6]=c,S[7]=d,S[8]=u}else a=S[1],n=S[2],s=S[3],o=S[4],l=S[5],c=S[6],d=S[7],u=S[8];let b=u;S[9]!==n||S[10]!==o||S[11]!==l?(m=()=>n?{"aria-haspopup":"menu","aria-expanded":o}:{"aria-pressed":l},S[9]=n,S[10]=o,S[11]=l,S[12]=m):m=S[12];let j=m;S[13]!==j?(h=j(),S[13]=j,S[14]=h):h=S[14],S[15]!==b||S[16]!==h?(p={...b,...h},S[15]=b,S[16]=h,S[17]=p):p=S[17];let w=p,N=n&&d?d:a;S[18]!==c?(g=e=>{c&&c(e)},S[18]=c,S[19]=g):g=S[19];let I=g,E=l&&_.selected;return S[20]!==E?(f=(0,C.$)(_.toggleButton,E),S[20]=E,S[21]=f):f=S[21],S[22]!==s?(y=!!s&&(0,r.jsx)("span",{className:_.icon,children:s}),S[22]=s,S[23]=y):y=S[23],S[24]!==N?(x=(0,r.jsx)("span",{className:_.textContent,children:N}),S[24]=N,S[25]=x):x=S[25],S[26]!==w||S[27]!==I||S[28]!==t||S[29]!==f||S[30]!==y||S[31]!==x?(v=(0,r.jsxs)("button",{ref:t,type:"button",className:f,onClick:I,...w,children:[y,x]}),S[26]=w,S[27]=I,S[28]=t,S[29]=f,S[30]=y,S[31]=x,S[32]=v):v=S[32],v});S.displayName="ToggleButton";var b=a(76872),j=a(35247);function w(){let[e,t]=(0,m.useState)(!1),a=(0,o.Zp)(),{handleSpaceSelect:n,clearSpaceSelection:i,activeCopilotSpaceId:g,readOnly:f}=(0,x.C)(),C=(0,m.useRef)(null),_=(0,m.useRef)(null),[w,N]=(0,m.useState)(!1),I=()=>{N(!0),(0,s.BI)("dotcom_chat.activate",{target:"SPACES_INPUT_CREATE_SPACE",mode:"immersive"})},{data:E=[],isLoading:T}=y(),{data:A=[],isLoading:R}=(0,p.jS)(!0),k=(0,p.BV)(),L=T||R;if((0,m.useEffect)(()=>{if(L&&e&&C.current)C.current.focus();else if(!L&&e&&_.current){let e=setTimeout(()=>{_.current?.focus()},0);return()=>clearTimeout(e)}},[L,e]),!k||f)return;let P=g?A.find(e=>e.id===g.id&&e.owner===g.owner):void 0,M=P?P.name:"Spaces",O="260px";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.W,{open:e,onOpenChange:e=>{j.W.spacesAsAttachmentsEnabled&&e&&(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_COPILOT_SPACES",mode:"immersive"}),t(e)},children:[(0,r.jsx)(l.W.Anchor,{children:(0,r.jsx)(S,{icon:(0,r.jsx)(h.I,{icon:"spaces"}),isSelected:!!P,onClick:()=>{},hasMenu:!0,"aria-label":"Select a copilot space for this conversation",isMenuOpen:e,selectedItemLabel:M,children:M})}),(0,r.jsx)(l.W.Overlay,{style:E.length>0?{width:O}:{},children:L?(0,r.jsxs)(c.B,{direction:"horizontal",align:"center",justify:"center",padding:"normal",style:{width:O},children:[(0,r.jsx)("div",{ref:C,role:"status",className:"sr-only",tabIndex:-1,children:"Loading spaces"}),(0,r.jsx)(d.A,{})]}):(0,r.jsx)(u.l,{selectionVariant:"single",role:"menu","aria-label":"Select a space",children:E.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(u.l.Group,{children:[(0,r.jsx)(u.l.GroupHeading,{"aria-label":"Recent spaces",children:"Recent"}),E.map((e,a)=>{let o=!!g&&e.id===g.id&&e.owner===g.owner;return(0,r.jsx)(u.l.Item,{ref:0===a?_:void 0,role:"menuitemradio",onSelect:()=>{g&&e.id===g.id&&e.owner===g.owner?i():(n({id:e.id,owner:e.owner}),(0,s.BI)("dotcom_chat.activate",{target:"SPACES_INPUT_SELECT_SPACE",space:`${e.owner}/${e.id}`})),t(!1)},selected:o,"aria-checked":o,children:(0,r.jsx)("span",{children:e.name})},`${e.owner}, ${e.id}`)})]}),(0,r.jsx)(u.l.Divider,{}),(0,r.jsx)(u.l.Item,{onSelect:()=>{a(v.VR),(0,s.BI)("dotcom_chat.activate",{target:"SPACES_INPUT_VIEW_ALL_SPACES",mode:"immersive"})},children:"View all spaces"}),(0,r.jsx)(u.l.Divider,{}),(0,r.jsx)(u.l.Item,{onSelect:I,children:"Create a space"})]}):(0,r.jsx)(u.l.Item,{ref:_,onSelect:I,children:"Create your first space"})})})]}),w?(0,r.jsx)(b.D,{closeDialog:()=>{(0,s.BI)("dotcom_chat.activate",{target:"COPILOT_SPACE_CREATE_DIALOG_CLOSE",mode:"immersive"}),N(!1)}}):null]})}try{w.displayName||(w.displayName="SpacesSelect")}catch{}var N=a(29731),I=a(83494),E=a(8625),T=a(38621),A=a(52870),R=a(59121),k=a(21373),L=a(26108),P=a(94747),M=a(96379),O=a(7277),D=a(47970),F=a(33592),B=a(79216),$=a(97949);let z=/^(?:https:\/\/)?(?:www\.)?(figma\.com\/.+)$/,U=class FigmaNotAuthorizedError extends Error{constructor(){super(),this.name="FigmaNotAuthorizedError"}};async function W(e){let t=await (0,M.lS)(`/copilot/immersive/figma-link?item_url=${e}`);if(!t.ok){if(403===t.status)throw new U;throw Error(`Failed to fetch Figma reference data (${t.status}: ${t.statusText})`)}return await t.json()}async function V(e){let{itemUrl:t}=e,a=await (0,M.lS)(`/copilot/chat-links?item_url=${t}`);if(!a.ok)throw Error(`Failed to fetch reference data (${a.status}: ${a.statusText})`);return await a.json()}var H=a(91474),q=a(88431),K=a(96459),G=a(17925),Q=a(79064),Z=a(72303);let J=async(e,t,a,n,r,i)=>{if((e[0]??"")!=="/")return!1;e=e.substring(1);let o=(({manager:e,chatState:t,availableCommands:a})=>{let n="assistive"===t.mode?[{label:"Delete chat",key:"delete",icon:T.TrashIcon,action:async(t,a)=>{e.dispatch({type:"SLASH_COMMANDS_LOADING"});try{let t=(0,Z.W)(a);if(!t)throw Error("Thread not found");await e.deleteThread(t),(0,s.BI)("dotcom_chat.activate",{target:"SLASH_COMMAND_DELETE_THREAD",mode:a.mode}),e.dispatch({type:"SLASH_COMMANDS_LOADED"})}catch{e.dispatch({type:"SLASH_COMMANDS_ERROR"})}return!0}},{label:"Rename conversation",key:"rename",icon:T.PencilIcon,action:async(t,a)=>{e.dispatch({type:"SLASH_COMMANDS_LOADING"});try{let n=(0,Z.W)(a);if(!n)throw Error("Thread not found");await e.renameThread(n,t),(0,s.BI)("dotcom_chat.activate",{target:"SLASH_COMMAND_RENAME",mode:a.mode}),e.dispatch({type:"SLASH_COMMANDS_LOADED"})}catch{e.dispatch({type:"SLASH_COMMANDS_ERROR"})}return!0}},{label:"Start a new conversation",key:"new",icon:T.PlusIcon,action:async(t,a)=>{e.dispatch({type:"SLASH_COMMANDS_LOADING"});try{await e.selectThread(null),(0,s.BI)("dotcom_chat.activate",{target:"SLASH_COMMAND_NEW_THREAD",mode:a.mode}),e.dispatch({type:"SLASH_COMMANDS_LOADED"})}catch{e.dispatch({type:"SLASH_COMMANDS_ERROR"})}return!0}}]:[];if("immersive"===t.mode&&j.W.chatInputCommands)for(let t of a)t.execute&&n.push({key:t.key,action:async(a,n,r)=>await t.execute(a,n,r,e)});return n})({manager:a,chatState:t,availableCommands:r}).filter(t=>{let a=(e.split(" ",1)[0]??"").toLowerCase().trim();return t.key.toLowerCase().includes(a)});if(1!==o.length)return!1;let l=o[0],c=e.substring(l.key.length).trim();return i&&(i.selectedRepo||i.selectedBranch||i.selectedCustomAgent)&&(c=JSON.stringify({text:c,selectedRepo:i.selectedRepo,selectedBranch:i.selectedBranch,selectedCustomAgent:i.selectedCustomAgent})),(0,s.BI)("dotcom_chat.activate",{target:"SLASH_COMMAND_EXECUTED",mode:t.mode,command:l.key}),await l.action(c,t,n)};var Y=a(46062),X=a(56708),ee=a(61180);function et(e,t,a){if("immersive"===e&&/^\/copilot(\/agents|\/spaces\/[a-zA-Z0-9-_]+\/[0-9]+)?\/?$/.test(t)){let e=a.get("prompt");if(e)return e}}var ea=a(26239),en=a(60905),er=a(76166),ei=a(72439),es=a(23657),eo=a(72206);function el({openCreateSpaceDialog:e,setPendingSpace:t,clearSpaceSelection:a,activeCopilotSpaceId:n,readOnly:i}){let h=(0,F.b)(),[g,f]=(0,m.useState)(!1),x=(0,o.Zp)(),C=(0,m.useRef)(null),_=(0,m.useRef)(null),[S,j]=(0,m.useState)(!1),w=()=>{j(!0),e(!0),(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_COPILOT_SPACES_CREATE_SPACE",mode:"immersive"})},{data:N=[],isLoading:I}=y(),{isLoading:E}=(0,p.jS)(!0),A=(0,p.BV)(),R=I||E;if((0,m.useEffect)(()=>{if(R&&g&&C.current)C.current.focus();else if(!R&&g&&_.current){let e=setTimeout(()=>{_.current?.focus()},0);return()=>clearTimeout(e)}},[R,g]),!A||i)return;let k="260px";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.W,{open:g,onOpenChange:e=>{e&&(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_COPILOT_SPACES",mode:"immersive"}),f(e)},children:[(0,r.jsx)(l.W.Anchor,{children:(0,r.jsxs)(u.l.Item,{onSelect:()=>{(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_COPILOT_SPACES",mode:"immersive"})},children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.SpaceIcon,{})}),"Spaces\u2026"]})}),(0,r.jsx)(l.W.Overlay,{style:N.length>0?{width:k}:{},children:R?(0,r.jsxs)(c.B,{direction:"horizontal",align:"center",justify:"center",padding:"normal",style:{width:k},children:[(0,r.jsx)("div",{ref:C,role:"status",className:"sr-only",tabIndex:-1,children:"Loading spaces"}),(0,r.jsx)(d.A,{})]}):(0,r.jsx)(u.l,{selectionVariant:"single",role:"menu","aria-label":"Select a space",children:N.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(u.l.Group,{children:[(0,r.jsx)(u.l.GroupHeading,{"aria-label":"Recent spaces",children:"Recent"}),N.map((e,i)=>{let o=!!n&&e.id===n.id&&e.owner===n.owner;return(0,r.jsx)(u.l.Item,{ref:0===i?_:void 0,role:"menuitemradio",onSelect:()=>{n&&e.id===n.id&&e.owner===n.owner?a():(h.addReference({...e,type:"copilot-space"},"spaces"),t({id:e.id,owner:e.owner}),(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_COPILOT_SPACES_SELECT_SPACE",space:`${e.owner}/${e.id}`})),f(!1)},selected:o,"aria-checked":o,children:(0,r.jsx)("span",{children:e.name})},`${e.owner}, ${e.id}`)})]}),(0,r.jsx)(u.l.Divider,{}),(0,r.jsx)(u.l.Item,{onSelect:()=>{x(v.VR),(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_COPILOT_SPACES_VIEW_ALL_SPACES",mode:"immersive"})},children:"View all spaces"}),(0,r.jsx)(u.l.Divider,{}),(0,r.jsx)(u.l.Item,{onSelect:w,children:"Create a space"})]}):(0,r.jsx)(u.l.Item,{ref:_,onSelect:w,children:"Create your first space"})})})]}),S?(0,r.jsx)(b.D,{closeDialog:()=>{(0,s.BI)("dotcom_chat.activate",{target:"COPILOT_SPACE_CREATE_DIALOG_CLOSE",mode:"immersive"}),j(!1)}}):null]})}try{el.displayName||(el.displayName="SpacesSelectNew")}catch{}var ec=a(14521),ed=a(47789),eu=a(99054),em=a(77430);function eh(e){let t,a,n,o,c,d,m=(0,i.c)(24),{onSelectPanel:h,onSelectAgent:p}=e,{availableAgents:g,showLimit:f,disabled:y,loading:x}=(0,eu.JE)(),v=g&&g.length>0;if(x){let e;return m[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsxs)(u.l.Item,{disabled:!0,children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.AppsIcon,{})}),"Extensions\u2026"]}),m[0]=e):e=m[0],e}if(y){let e,t,a;return m[1]!==h?(e=()=>{(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_EXTENSION_NOT_SUPPORTED",mode:"immersive"}),h("agents-not-supported")},m[1]=h,m[2]=e):e=m[2],m[3]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.AppsIcon,{})}),m[3]=t):t=m[3],m[4]!==e?(a=(0,r.jsxs)(u.l.Item,{onSelect:e,children:[t,"Extensions\u2026"]}),m[4]=e,m[5]=a):a=m[5],a}if(!v){let e,t,a;return m[6]!==h?(e=()=>{(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_EXTENSION_NOT_AVAILABLE",mode:"immersive"}),h("no-agents-available")},m[6]=h,m[7]=e):e=m[7],m[8]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.AppsIcon,{})}),m[8]=t):t=m[8],m[9]!==e?(a=(0,r.jsxs)(u.l.Item,{onSelect:e,children:[t,"Extensions\u2026"]}),m[9]=e,m[10]=a):a=m[10],a}if(m[11]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(l.W.Anchor,{children:(0,r.jsxs)(u.l.Item,{onSelect:eg,children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.AppsIcon,{})}),"Extensions\u2026"]})}),m[11]=t):t=m[11],m[12]!==g||m[13]!==p||m[14]!==f){let e;m[16]!==p||m[17]!==f?(e=e=>(0,r.jsxs)(u.l.Item,{onSelect:()=>{(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_EXTENSION_SELECTED",mode:"immersive"}),p(e)},children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(em.r,{src:e.avatarUrl})}),e.name,!f&&(0,r.jsxs)(u.l.Description,{variant:"inline",truncate:!0,children:[eu.Z3,e.slug]}),f&&(0,r.jsx)(u.l.Description,{variant:"block",children:"Start a new chat to use other extensions."})]},e.slug),m[16]=p,m[17]=f,m[18]=e):e=m[18],a=g.map(e),m[12]=g,m[13]=p,m[14]=f,m[15]=a}else a=m[15];return m[19]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)(u.l.Divider,{}),m[19]=n):n=m[19],m[20]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.TelescopeIcon,{})}),m[20]=o):o=m[20],m[21]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsxs)(u.l.LinkItem,{href:eu.bn,onClick:ep,children:[o,"Marketplace",(0,r.jsx)(u.l.TrailingVisual,{children:(0,r.jsx)(T.LinkExternalIcon,{})})]}),m[21]=c):c=m[21],m[22]!==a?(d=(0,r.jsxs)(l.W,{children:[t,(0,r.jsx)(l.W.Overlay,{width:"small",children:(0,r.jsxs)(u.l,{children:[a,n,c]})})]}),m[22]=a,m[23]=d):d=m[23],d}function ep(){(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_EXTENSION_MARKETPLACE",mode:"immersive"})}function eg(){(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_EXTENSION",mode:"immersive"})}try{eh.displayName||(eh.displayName="AgentMenu")}catch{}var ef=a(57352),ey=a(15220);let ex={AgentsDialogsMainContainer:"AgentsDialogs-module__AgentsDialogsMainContainer--ymBth",dialogContentWrapper:"AgentsDialogs-module__dialogContentWrapper--v7abd",dialogTitle:"AgentsDialogs-module__dialogTitle--tEo3x",dialogDescription:"AgentsDialogs-module__dialogDescription--LPgKm",documentationLinkContainer:"AgentsDialogs-module__documentationLinkContainer--ydpZ9",AgentsDialogsAlternateContainer:"AgentsDialogs-module__AgentsDialogsAlternateContainer--iIZFy",alertIconContainer:"AgentsDialogs-module__alertIconContainer--jNjdz"};function ev(e){let t,a,n=(0,i.c)(4),{onClose:s,returnFocusRef:o}=e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(t={narrow:"fullscreen",regular:"center"},n[0]=t):t=n[0],n[1]!==s||n[2]!==o?(a=(0,r.jsx)(ey.l,{width:"large",title:"Extensions",position:t,onClose:s,returnFocusRef:o,renderBody:eC}),n[1]=s,n[2]=o,n[3]=a):a=n[3],a}function eC(){return(0,r.jsx)("div",{className:ex.AgentsDialogsMainContainer,children:(0,r.jsxs)("div",{className:ex.dialogContentWrapper,children:[(0,r.jsx)(T.TelescopeIcon,{size:24}),(0,r.jsx)("h3",{className:ex.dialogTitle,children:"Chat with your favorite tools and services"}),(0,r.jsx)("p",{className:ex.dialogDescription,children:"Browse the marketplace to find extensions for the tools and services you rely on"}),(0,r.jsx)(k.Q,{as:"a",href:eu.bn,children:"Browse marketplace"}),(0,r.jsx)("div",{className:ex.documentationLinkContainer,children:(0,r.jsx)(ef.A,{href:"https://gh.io/copilot-extensions-docs",children:"Documentation"})})]})})}function e_(e){let t,a,n,s=(0,i.c)(9),{onClose:o,returnFocusRef:l}=e,c=(0,F.b)(),d=(0,g.Pk)(),u=(0,p.BV)(),m=(0,Y.GF)(d.availableModels);return s[0]===Symbol.for("react.memo_cache_sentinel")?(t={narrow:"fullscreen",regular:"center"},s[0]=t):t=s[0],s[1]!==u||s[2]!==m||s[3]!==c?(a=()=>(0,r.jsx)("div",{className:ex.AgentsDialogsAlternateContainer,children:(0,r.jsxs)("div",{className:ex.dialogContentWrapper,children:[(0,r.jsx)("div",{className:ex.alertIconContainer,children:(0,r.jsx)(T.AlertIcon,{size:24})}),(0,r.jsxs)("h3",{className:ex.dialogTitle,children:[u?"Copilots and extensions":"Extensions"," aren't supported by this model"]}),(0,r.jsxs)("p",{className:ex.dialogDescription,children:["Switch back to the ",m.displayName," model or start a new chat"]}),(0,r.jsx)(k.Q,{onClick:()=>{c.selectThread(null),c.selectModel(m)},children:"New chat"})]})}),s[1]=u,s[2]=m,s[3]=c,s[4]=a):a=s[4],s[5]!==o||s[6]!==l||s[7]!==a?(n=(0,r.jsx)(ey.l,{width:"large",title:"Extensions",position:t,onClose:o,returnFocusRef:l,renderBody:a}),s[5]=o,s[6]=l,s[7]=a,s[8]=n):n=s[8],n}try{ev.displayName||(ev.displayName="NoAgentsAvailableDialog")}catch{}try{e_.displayName||(e_.displayName="AgentsNotSupportedDialog")}catch{}var eS=a(77809),eb=a(97564);function ej(e){let t,a,n,s=(0,i.c)(10),{isOpen:o,onClose:l,initialRepo:c,onRepoSelect:d}=e,u=(0,F.b)(),{findFileWorkerPath:h}=(0,g.Pk)(),p=(0,m.useRef)(null);s[0]!==u||s[1]!==l?(t=async e=>{if(0===e.length)return void l();let t=await (0,eb.V)(e[0].repositoryId);for(let a of e.map(e=>"github_folder"===e.type?(0,v.OC)(e.filePath,t):(0,v.Od)(e.filePath,t)))u.addReference(a,"references-menu");l()},s[0]=u,s[1]=l,s[2]=t):t=s[2];let f=t;return o?(s[3]===Symbol.for("react.memo_cache_sentinel")?(a=[],s[3]=a):a=s[3],s[4]!==h||s[5]!==f||s[6]!==c||s[7]!==l||s[8]!==d?(n=(0,r.jsx)(eS.Q,{formData:a,onCancel:l,onSaveFiles:f,findFileWorkerPath:h,attachmentButtonRef:p,initialRepo:c,onRepoSelect:d,allowFolderReferences:!0,maxFileCount:20}),s[4]=h,s[5]=f,s[6]=c,s[7]=l,s[8]=d,s[9]=n):n=s[9],n):null}try{ej.displayName||(ej.displayName="CopilotFilePicker")}catch{}var ew=a(82075),eN=a(5839),eI=a(31604),eE=a(81960),eT=a(69497),eA=a(10095),eR=a(87448),ek=a(40961);let eL={disabledForPreviewModelsPanel:"KnowledgeSelectPanel-module__disabledForPreviewModelsPanel--5fRzV",knowledgeBaseIcon:"KnowledgeSelectPanel-module__knowledgeBaseIcon--peP3C",KnowledgeSelectPanelContainer:"KnowledgeSelectPanel-module__KnowledgeSelectPanelContainer--_RbkD",panelHeader:"KnowledgeSelectPanel-module__panelHeader--kWY60",headerContent:"KnowledgeSelectPanel-module__headerContent--AQ0gC",panelTitle:"KnowledgeSelectPanel-module__panelTitle--oQLU4",emptyStateContainer:"KnowledgeSelectPanel-module__emptyStateContainer--Rk1JI",emptyStateContent:"KnowledgeSelectPanel-module__emptyStateContent--BiaDj",emptyStateMessage:"KnowledgeSelectPanel-module__emptyStateMessage--S8iOa",emptyStateDescription:"KnowledgeSelectPanel-module__emptyStateDescription--d4gqH",emptyStateInstructions:"KnowledgeSelectPanel-module__emptyStateInstructions--pOJKv",actionButtonsContainer:"KnowledgeSelectPanel-module__actionButtonsContainer--NjnfZ",createButton:"KnowledgeSelectPanel-module__createButton--AfP6G",organizationsSection:"KnowledgeSelectPanel-module__organizationsSection--YaCxl",sectionTitle:"KnowledgeSelectPanel-module__sectionTitle--hm4Tw",organizationsList:"KnowledgeSelectPanel-module__organizationsList--UvNcy",organizationLink:"KnowledgeSelectPanel-module__organizationLink--UkWa7",organizationAvatar:"KnowledgeSelectPanel-module__organizationAvatar--igPHI",organizationName:"KnowledgeSelectPanel-module__organizationName--V_3Jw",ssoNotice:"KnowledgeSelectPanel-module__ssoNotice--EKDTO"},eP=(0,m.forwardRef)(function({open:e,setOpen:t,...a},n){return(0,r.jsx)(L.K,{ref:n,"aria-expanded":!!e||void 0,"aria-haspopup":!0,"aria-label":"Attach knowledge base","aria-labelledby":void 0,icon:T.BookIcon,onClick:()=>t(!e),variant:"invisible",className:eL.knowledgeBaseIcon,...a})});function eM({disabledForPreviewModelsProps:e,emptyKnowledgeBaseProps:t,open:a,onOpenChange:n,anchorRef:i}){let s=(0,g.Pk)(),o=(0,F.b)(),l=(0,ew.A)("localStorage"),{knowledgeBases:c}=s,[d,u]=(0,m.useState)([]),[h,p]=(0,m.useState)(!0),[f,y]=(0,m.useState)(""),x=(0,m.useRef)(null),C=l.getItem("lastUsedKnowledgeBaseId")||"",_=l.getItem("lastUsedKnowledgeBaseOrg")||"",{currentReferences:S}=s;(0,m.useEffect)(()=>{a||y("")},[a]);let b=(0,m.useMemo)(()=>""===f?c:c.filter(e=>e.name.toLowerCase().includes(f.toLowerCase())),[f,c]),j=(0,m.useMemo)(()=>b.reduce((e,t)=>{let a=e.find(e=>e.org===t.ownerLogin);return a?a.docsets.push(t):e.push({org:t.ownerLogin,docsets:[t]}),e},[]),[b]),[w,I]=(0,m.useState)(!1),E=h||"pending"===s.knowledgeBasesLoading.state,T=w||"error"===s.knowledgeBasesLoading.state,A=(0,m.useRef)(!1);(0,m.useEffect)(()=>{let e=async()=>{p(!0),await o.fetchKnowledgeBases();let e=await o.service.listAdministratedCopilotEnterpriseOrganizations();e.ok?u(e.payload||[]):I(!0),p(!1)};a&&!A.current&&(A.current=!0,e())},[a,o]);let R=e$();if(s.model?.hasLimitedCapabilities)return(0,r.jsx)(eU,{open:a,setOpen:n,...e});if(!E&&0===c.length)return(0,r.jsx)(eO,{administratedCopilotEnterpriseOrganizations:d,persistentPanelStyles:{position:["fixed","fixed","absolute"],bottom:["60px","60px","0 !important"],"@media screen and (max-height: 480px)":{bottom:"0 !important"},top:"initial !important",left:["18px","18px","calc(50% - 360px) !important"],maxHeight:"100%"},open:a,setOpen:n,mode:s.mode,...t});let k=b.sort((e,t)=>e.id===C?-1:+(t.id===C)).map(e=>({id:e.id,key:e.id,groupId:e.ownerLogin,text:e.name,description:e.description,disabled:!e.canChat,descriptionVariant:"block"})),L=[...j].sort((e,t)=>e.org===_?-1:+(t.org===_)).map(e=>({id:e.org,key:e.org,text:e.org,groupId:e.org,header:{title:e.org}})),P=c.filter(e=>S.some(t=>(0,v.P)(t)&&t.id===e.id));return(0,r.jsx)("div",{ref:x,...(0,N.G)("knowledge-select-panel"),children:(0,r.jsx)(eN.X,{title:"Select knowledge bases",subtitle:"Knowledge bases consolidate content from multiple repositories for an improved chat experience.",onCancel:()=>{(0,ek.flushSync)(()=>n(!1)),i.current?.focus()},open:a,renderAnchor:null,anchorRef:i,onOpenChange:n,loading:E,items:k,onFilterChange:y,groupMetadata:L,notice:null!==R?{text:R,variant:"info"}:void 0,message:T?{variant:"error",title:"Failed to load knowledge bases",body:"Try again later"}:0===j.length?{variant:"empty",title:`No knowledge bases found for \`${f}\``,body:"Try a different search term"}:void 0,...{selected:P,onSelectedChange:e=>(e=>{var t=e.map(e=>c.find(t=>t.id===e.id)).filter(e=>void 0!==e);let a=t.filter(e=>(0,v.P)(e)&&!S.some(t=>(0,v.P)(t)&&t.id===e.id));for(let e of S.filter(e=>(0,v.P)(e)&&!t.some(t=>t.id===e.id)))o.removeReference(e);for(let e of a)o.addReference((0,v.UU)(e),"docsetMenu")})(e)},variant:"modal",overlayProps:{maxHeight:"xlarge"},width:"large"})})}function eO({administratedCopilotEnterpriseOrganizations:e,anchorRef:t,open:a,setOpen:n}){let i=e$(),s=t?{anchorRef:t,renderAnchor:null}:{anchorRef:void 0,renderAnchor:({...e})=>(0,r.jsx)(eP,{open:a,setOpen:n,...e})},o=e?.length===0;return(0,r.jsx)(eI.T,{open:a,onOpen:()=>n(!0),onClose:()=>n(!1),overlayProps:{anchorSide:"outside-bottom",style:{width:"min(100%, 350px)"}},...s,children:(0,r.jsxs)(eR.az,{role:"dialog","aria-labelledby":"knowledge-base-dialog-title",sx:{...o?{height:"100%"}:{}},className:eL.KnowledgeSelectPanelContainer,...(0,N.G)("empty-knowledge-base-picker"),children:[(0,r.jsx)("div",{className:eL.panelHeader,children:(0,r.jsxs)("div",{className:eL.headerContent,children:[(0,r.jsx)(eE.A,{id:"knowledge-base-dialog-title",as:"h4",className:eL.panelTitle,children:"Attach a knowledge base"}),(0,r.jsx)(L.K,{unsafeDisableTooltip:!0,"aria-label":"Close",icon:T.XIcon,variant:"invisible",onClick:()=>n(!1)})]})}),(0,r.jsxs)(eR.az,{sx:{...o?{flexGrow:1,maxHeight:"100%",overflowY:"auto"}:{}},className:eL.emptyStateContainer,children:[(0,r.jsx)(eA.A,{icon:T.BookIcon,size:"medium",className:eL.knowledgeBaseIcon}),(0,r.jsxs)(eR.az,{sx:{...o?{maxHeight:"100%"}:{}},className:eL.emptyStateContent,children:[(0,r.jsx)("span",{className:eL.emptyStateMessage,children:"You don't have any knowledge bases"}),(0,r.jsxs)("div",{className:eL.emptyStateDescription,children:[(0,r.jsx)("p",{children:"Knowledge bases consolidate content from multiple repositories for an improved chat experience."}),o&&(0,r.jsx)("p",{className:eL.emptyStateInstructions,...(0,N.G)("ask-admin-for-knowledge-base"),children:"Speak with an organization owner about creating a knowledge base for your organization."})]}),e.length>0&&(0,r.jsx)(eD,{administratedCopilotEnterpriseOrganizations:e})]})]}),i&&(0,r.jsx)("div",{className:eL.actionButtonsContainer,children:(0,r.jsx)(eB,{message:i})})]})})}function eD({administratedCopilotEnterpriseOrganizations:e}){return 1===e.length?(0,r.jsx)(k.Q,{as:"a",href:ez(e[0]),className:eL.createButton,...(0,N.G)("create-knowledge-base-button"),children:"Create a knowledge base"}):(0,r.jsxs)("div",{className:eL.organizationsSection,...(0,N.G)("create-knowledge-base-dropdown"),children:[(0,r.jsx)(eE.A,{as:"h3",className:eL.sectionTitle,children:"Create a knowledge base for an organization"}),(0,r.jsx)(u.l,{className:eL.organizationsList,children:e.map(e=>(0,r.jsx)(eF,{org:e},e.id))})]})}function eF({org:e}){return(0,r.jsx)(u.l.Item,{children:(0,r.jsxs)(ef.A,{href:ez(e),className:eL.organizationLink,children:[(0,r.jsx)(em.r,{square:!0,src:e.avatarUrl,alt:e.login,"aria-hidden":"true",className:eL.organizationAvatar}),(0,r.jsx)(eT.A,{inline:!0,title:e.login,className:eL.organizationName,children:e.login})]})})}function eB({message:e}){return e?(0,r.jsx)("div",{"data-testid":"knowledge-select-panel-sso",className:eL.ssoNotice,children:e}):null}function e$(){let e=(0,g.Pk)(),t=e.ssoOrganizations.map(e=>e.login);for(let a of e.knowledgeBases)for(let e of a.protectedOrganizations)t.includes(e)||t.push(e);if(!t||0===t.length)return null;{if(1===t.length)return`Single sign-on to see content from ${t[0]}.`;if(2===t.length)return`Single sign-on to see content from ${t[0]} and ${t[1]}.`;let e=t.length-2;return`Single sign-on to see content from ${t[0]}, ${t[1]}, and ${e} organization${e>1?"s":""}`}}function ez(e){return`/organizations/${e.login}/settings/copilot/chat_settings/new`}function eU({anchorRef:e,open:t,setOpen:a}){let n=e?{anchorRef:e,renderAnchor:null}:{anchorRef:void 0,renderAnchor:({...e})=>(0,r.jsx)(eP,{open:t,setOpen:a,...e})};return(0,r.jsx)(eI.T,{open:t,onOpen:()=>a(!0),onClose:()=>a(!1),...n,children:(0,r.jsxs)("div",{className:(0,C.$)("m-3 d-flex flex-column flex-items-center text-center",eL.disabledForPreviewModelsPanel),children:[(0,r.jsx)(T.AlertIcon,{className:"fgColor-attention mb-3"}),(0,r.jsx)("h3",{className:"h5 mb-2",children:"Knowledge bases aren't supported by this model"}),(0,r.jsx)("span",{className:"text-small fgColor-muted",children:"Switch back to the GPT-4o model or start a new conversation"})]})})}try{eP.displayName||(eP.displayName="KBIconButton")}catch{}try{(n=KBIconButtonInner).displayName||(n.displayName="KBIconButtonInner")}catch{}try{eM.displayName||(eM.displayName="KnowledgeSelectPanel")}catch{}try{eO.displayName||(eO.displayName="EmptyKnowledgeBase")}catch{}try{eD.displayName||(eD.displayName="CreateKnowledgeBaseButton")}catch{}try{eF.displayName||(eF.displayName="CreateKnowledgeBaseActionRow")}catch{}try{eB.displayName||(eB.displayName="SSOFooter")}catch{}try{eU.displayName||(eU.displayName="DisabledForPreviewModels")}catch{}var eW=a(35673),eV=a(71363);let eH=(0,m.memo)(({panel:e,onPanelChange:t,anchorRef:a,initialRepo:n,onRepoSelect:i,...o})=>{let{inputRef:c}=o,d=(0,F.b)(),h=(0,g.Pk)(),p=(0,ed.qw)(),{supportedAttachmentTypes:f,supportedReferenceTypes:y}=function(){let e=(0,g.Pk)(),t=null!==(0,ec.G)(),a=["upload"],n=e.renderKnowledgeBases&&(e.currentTopic&&(0,v.Z6)(e.currentTopic)||!e.currentTopic),r=j.W.knowledgeBasesDisabled;return t||a.push("repositories"),!n||t||r||a.push("knowledge-bases"),!t&&j.W.spacesAsAttachmentsEnabled&&a.push("copilot-spaces"),t||a.push("agents"),t||a.push("plugin-attachment-contribution"),{supportedAttachmentTypes:a,supportedReferenceTypes:t?["files"]:["files","folders"]}}(),{model:C}=(0,g.bP)("model"),_="immersive"===h.mode&&!!C.capabilities?.supports?.vision,S=(0,eu.kw)(o),w=(0,m.useRef)(null),I=(0,ec.G)(),E=(0,es.FQ)(!0),{handleSpaceSelect:A,clearSpaceSelection:R,activeCopilotSpaceId:k,readOnly:L}=(0,x.C)(),P=!!(I&&E),[M,O]=(0,m.useState)(!1);return(0,r.jsxs)("div",{children:[f.includes("upload")&&(0,r.jsx)("input",{id:"image-uploader",...(0,N.G)("image-uploader"),hidden:!0,ref:w,type:"file",accept:[_?en.s.getAllowedImageFileExtensions(C):"",ei.E.getTextFileExtensions()].join(","),multiple:!0,onChange:e=>{if(!e.target.files)return;let[t,a]=en.s.getAllowedFiles([...e.target.files],C),n=[];for(let e of(_?new en.s(h,d).addImageAttachments(t,"menu",I,P):n.push(...t),a))new ei.E(d).addAttachment(e);for(let e of n)(0,s.BI)("dotcom_chat.upload_unsupported_file",{name:e.name,type:e.type,size:e.size});e.currentTarget.value=""}}),(0,r.jsx)(l.W,{anchorRef:a,open:"attachment-types"===e,onOpenChange:e=>t(t=>e&&null===t?"attachment-types":e||"attachment-types"!==t?t:null),children:(0,r.jsx)(l.W.Overlay,{width:"small",side:"outside-bottom",align:"start",portalContainerName:"assistive"===h.mode?eW.E5:void 0,children:(0,r.jsxs)(u.l,{children:[f.includes("repositories")&&(0,r.jsxs)(u.l.Item,{onSelect:()=>{(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_REPOSITORIES",mode:h.mode}),t("repositories")},children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.RepoIcon,{})}),"Repositories\u2026"]}),(0,r.jsxs)(u.l.Item,{onSelect:()=>{(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_MULTI_FILE_PICKER",mode:h.mode}),t("multi-file-picker")},children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.FileCodeIcon,{})}),function(e){let t=e.includes("files"),a=e.includes("folders"),n=e.includes("symbols");return t&&a&&n?"Files, folders, and symbols":t&&a?"Files and folders":t&&n?"Files and symbols":a&&n?"Folders and symbols":t?"Files":a?"Folders":n?"Symbols":"References"}(y),"\u2026"]}),f.includes("knowledge-bases")&&(0,r.jsxs)(u.l.Item,{onSelect:()=>{(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_KNOWLEDGE_BASES",mode:h.mode}),t("knowledge-bases")},children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.BookIcon,{})}),(0,r.jsx)("span",{...(0,N.G)("knowledge-bases-action-list-item"),children:"Knowledge bases\u2026"})]}),f.includes("copilot-spaces")&&(0,r.jsx)(el,{openCreateSpaceDialog:O,setPendingSpace:A,clearSpaceSelection:R,activeCopilotSpaceId:k,readOnly:L}),p.map(e=>{let a=e.attachmentMenuContribution;return a?(0,r.jsx)(a.MenuItemComponent,{onSelect:()=>t(a.attachmentType)},e.id):null}),f.includes("upload")&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.l.Divider,{}),(0,r.jsxs)(u.l.Item,{onSelect:()=>{(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU_IMAGES",mode:h.mode}),t(null),w.current?.click()},children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.UploadIcon,{})}),"Upload from computer"]})]}),f.includes("agents")&&!j.W.hideExtensionsInDotcomChat&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.l.Divider,{}),(0,r.jsx)(eh,{onSelectPanel:e=>t(e),onSelectAgent:e=>setTimeout(()=>S(e.slug))})]})]})})}),"multi-file-picker"===e&&(0,r.jsx)(ej,{isOpen:!0,onClose:()=>t(null),initialRepo:n,onRepoSelect:i}),(0,r.jsx)(eV.FZ,{open:"repositories"===e,onOpenChange:e=>t(e?"repositories":null),submitReturnFocusRef:c,cancelReturnFocusRef:a}),f.includes("knowledge-bases")&&(0,r.jsx)(eM,{disabledForPreviewModelsProps:{anchorRef:a},emptyKnowledgeBaseProps:{anchorRef:a},open:"knowledge-bases"===e,onOpenChange:e=>t(e?"knowledge-bases":null),anchorRef:a}),M&&(0,r.jsx)(b.D,{closeDialog:()=>O(!1)}),"no-agents-available"===e&&(0,r.jsx)(ev,{onClose:()=>t(null),returnFocusRef:a}),"agents-not-supported"===e&&(0,r.jsx)(e_,{onClose:()=>t(null),returnFocusRef:a}),f.includes("plugin-attachment-contribution")&&p.map(n=>n.attachmentMenuContribution&&n.attachmentMenuContribution.attachmentType===e?(0,r.jsx)(n.attachmentMenuContribution.PanelComponent,{onSubmit:()=>{t(null),c.current?.focus()},onDismiss:()=>{t(null),a.current?.focus()}},n.id):null)]})});eH.displayName="AttachmentMenu";var eq=a(71555);let eK={agents:"Extensions",repositories:"Repositories",files:"Files and folders",issues:"Issues",pulls:"Pull requests",discussions:"Discussions"},eG=[{name:eK.agents,icon:T.AppsIcon,value:"agents",where:"start"},{name:eK.repositories,icon:T.RepoIcon,value:"repositories",where:"anywhere"},{name:eK.files,icon:T.FileIcon,value:"repositories:files",where:"anywhere"},{name:eK.issues,icon:T.IssueOpenedIcon,value:"repositories:issues",where:"anywhere"},{name:eK.pulls,icon:T.GitPullRequestIcon,value:"repositories:pulls",where:"anywhere"},{name:eK.discussions,icon:T.CommentDiscussionIcon,value:"repositories:discussions",where:"anywhere"}],eQ={is:e=>eG.some(t=>t.value===e)};function eZ(e){let t,a,n,s,o,l=(0,i.c)(12);return l[0]!==e?({agent:t,...a}=e,l[0]=e,l[1]=t,l[2]=a):(t=l[1],a=l[2]),l[3]!==t.avatarUrl?(n=(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(em.r,{src:t.avatarUrl})}),l[3]=t.avatarUrl,l[4]=n):n=l[4],l[5]!==t.slug?(s=(0,r.jsxs)(u.l.Description,{variant:"inline",truncate:!0,children:[eu.Z3,t.slug]}),l[5]=t.slug,l[6]=s):s=l[6],l[7]!==t.name||l[8]!==a||l[9]!==n||l[10]!==s?(o=(0,r.jsxs)(u.l.Item,{...a,children:[n,t.name,s]}),l[7]=t.name,l[8]=a,l[9]=n,l[10]=s,l[11]=o):o=l[11],o}try{eZ.displayName||(eZ.displayName="AgentSuggestion")}catch{}function eJ(e){let t,a,n,s,o,l,c,d,h=(0,i.c)(20);h[0]!==e?({leadingVisual:t,...a}=e,h[0]=e,h[1]=t,h[2]=a):(t=h[1],a=h[2]);let p=(0,m.useId)(),g=(0,m.useId)();return h[3]!==g||h[4]!==p?(n=(0,C.$)(p,g),h[3]=g,h[4]=p,h[5]=n):n=h[5],h[6]!==t?(s=void 0!==t&&(0,r.jsx)(u.l.LeadingVisual,{children:t}),h[6]=t,h[7]=s):s=h[7],h[8]!==p||h[9]!==a.children?(o=(0,r.jsx)("span",{id:p,children:a.children}),h[8]=p,h[9]=a.children,h[10]=o):o=h[10],h[11]!==g?(l=(0,r.jsx)("span",{className:"d-none","aria-hidden":!0,id:g,children:"Opens in new tab."}),h[11]=g,h[12]=l):l=h[12],h[13]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)(u.l.TrailingVisual,{children:(0,r.jsx)(T.LinkExternalIcon,{})}),h[13]=c):c=h[13],h[14]!==a||h[15]!==n||h[16]!==s||h[17]!==o||h[18]!==l?(d=(0,r.jsxs)(u.l.Item,{...a,"aria-labelledby":n,children:[s,o,l,c]}),h[14]=a,h[15]=n,h[16]=s,h[17]=o,h[18]=l,h[19]=d):d=h[19],d}try{eJ.displayName||(eJ.displayName="LinkSuggestion")}catch{}function eY(e){return{value:`@${e.slug}`,render:t=>(0,r.jsx)(eZ,{agent:e,...t})}}function eX(e){let t,a,n,s,o,l=(0,i.c)(9);return l[0]!==e?({leadingVisual:t,...a}=e,l[0]=e,l[1]=t,l[2]=a):(t=l[1],a=l[2]),l[3]!==t?(n=void 0!==t&&(0,r.jsx)(u.l.LeadingVisual,{children:t}),l[3]=t,l[4]=n):n=l[4],l[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(u.l.TrailingVisual,{children:(0,r.jsx)(T.ArrowRightIcon,{})}),l[5]=s):s=l[5],l[6]!==a||l[7]!==n?(o=(0,r.jsxs)(u.l.Item,{"aria-haspopup":!0,...a,children:[n,a.children,s]}),l[6]=a,l[7]=n,l[8]=o):o=l[8],o}try{eX.displayName||(eX.displayName="MultistepSuggestion")}catch{}function e0(e){let t,a,n,s,o=(0,i.c)(9);o[0]!==e?({category:a,...t}=e,o[0]=e,o[1]=t,o[2]=a):(t=o[1],a=o[2]);let{name:l,icon:c}=a;return o[3]!==c?(n=(0,r.jsx)(c,{}),o[3]=c,o[4]=n):n=o[4],o[5]!==l||o[6]!==t||o[7]!==n?(s=(0,r.jsx)(eX,{leadingVisual:n,...t,children:l}),o[5]=l,o[6]=t,o[7]=n,o[8]=s):s=o[8],s}try{e0.displayName||(e0.displayName="CategorySuggestion")}catch{}let e1={asyncSuggestion:"shared-module__asyncSuggestion--AXibl",stale:"shared-module__stale--R4Im6"};function e2(e){let t,a,n,s,o,l,c,d,m,h,p,g=(0,i.c)(25);g[0]!==e?({discussion:a,stale:s,className:t,...n}=e,g[0]=e,g[1]=t,g[2]=a,g[3]=n,g[4]=s):(t=g[1],a=g[2],n=g[3],s=g[4]);let f=s&&e1.stale;return g[5]!==t||g[6]!==f?(o=(0,C.$)(e1.asyncSuggestion,f,t),g[5]=t,g[6]=f,g[7]=o):o=g[7],g[8]!==a.state?(l="open"===a.state&&(0,r.jsx)(T.CommentDiscussionIcon,{className:"fgColor-open"}),g[8]=a.state,g[9]=l):l=g[9],g[10]!==a.state?(c="closed"===a.state&&(0,r.jsx)(T.DiscussionClosedIcon,{className:"fgColor-muted"}),g[10]=a.state,g[11]=c):c=g[11],g[12]!==l||g[13]!==c?(d=(0,r.jsxs)(u.l.LeadingVisual,{children:[l,c]}),g[12]=l,g[13]=c,g[14]=d):d=g[14],g[15]!==a.title?(m=(0,r.jsx)(eT.A,{title:a.title,maxWidth:350,children:a.title}),g[15]=a.title,g[16]=m):m=g[16],g[17]!==a.number?(h=(0,r.jsxs)(u.l.Description,{children:["#",a.number]}),g[17]=a.number,g[18]=h):h=g[18],g[19]!==n||g[20]!==o||g[21]!==d||g[22]!==m||g[23]!==h?(p=(0,r.jsxs)(u.l.Item,{...n,className:o,children:[d,m,h]}),g[19]=n,g[20]=o,g[21]=d,g[22]=m,g[23]=h,g[24]=p):p=g[24],p}try{e2.displayName||(e2.displayName="DiscussionSuggestion")}catch{}function e5(e){let t,a,n,s,o,l,c,d,m,h,p,g,f,y,x,v=(0,i.c)(35);if(v[0]!==e?({type:o,path:a,stale:s,className:t,...n}=e,v[0]=e,v[1]=t,v[2]=a,v[3]=n,v[4]=s,v[5]=o):(t=v[1],a=v[2],n=v[3],s=v[4],o=v[5]),v[6]!==t||v[7]!==a||v[8]!==n||v[9]!==s||v[10]!==o){let e=a.split("/"),i=e.pop();c=u.l.Item,h=n;let y=s&&e1.stale;v[19]!==t||v[20]!==y?(p=(0,C.$)(e1.asyncSuggestion,y,t),v[19]=t,v[20]=y,v[21]=p):p=v[21],v[22]!==o?(g=(0,r.jsx)(u.l.LeadingVisual,{children:"folder"===o?(0,r.jsx)(T.FileDirectoryFillIcon,{}):(0,r.jsx)(T.FileIcon,{})}),v[22]=o,v[23]=g):g=v[23],f=i,l=u.l.Description,d="inline",m=e.join("/"),v[6]=t,v[7]=a,v[8]=n,v[9]=s,v[10]=o,v[11]=l,v[12]=c,v[13]=d,v[14]=m,v[15]=h,v[16]=p,v[17]=g,v[18]=f}else l=v[11],c=v[12],d=v[13],m=v[14],h=v[15],p=v[16],g=v[17],f=v[18];return v[24]!==l||v[25]!==d||v[26]!==m?(y=(0,r.jsxs)(l,{variant:d,children:[m,"/"]}),v[24]=l,v[25]=d,v[26]=m,v[27]=y):y=v[27],v[28]!==c||v[29]!==h||v[30]!==p||v[31]!==g||v[32]!==f||v[33]!==y?(x=(0,r.jsxs)(c,{...h,className:p,children:[g,f,y]}),v[28]=c,v[29]=h,v[30]=p,v[31]=g,v[32]=f,v[33]=y,v[34]=x):x=v[34],x}try{e5.displayName||(e5.displayName="FileSuggestion")}catch{}function e3(e){let t,a,n,s,o,l,c,d,m,h,p,g,f=(0,i.c)(28);f[0]!==e?({issue:a,stale:s,className:t,...n}=e,f[0]=e,f[1]=t,f[2]=a,f[3]=n,f[4]=s):(t=f[1],a=f[2],n=f[3],s=f[4]);let y=s&&e1.stale;return f[5]!==t||f[6]!==y?(o=(0,C.$)(e1.asyncSuggestion,y,t),f[5]=t,f[6]=y,f[7]=o):o=f[7],f[8]!==a.state?(l="draft"===a.state&&(0,r.jsx)(T.IssueDraftIcon,{className:"fgColor-draft"}),f[8]=a.state,f[9]=l):l=f[9],f[10]!==a.state?(c="open"===a.state&&(0,r.jsx)(T.IssueOpenedIcon,{className:"fgColor-open"}),f[10]=a.state,f[11]=c):c=f[11],f[12]!==a.state?(d="closed"===a.state&&(0,r.jsx)(T.IssueClosedIcon,{className:"fgColor-done"}),f[12]=a.state,f[13]=d):d=f[13],f[14]!==l||f[15]!==c||f[16]!==d?(m=(0,r.jsxs)(u.l.LeadingVisual,{children:[l,c,d]}),f[14]=l,f[15]=c,f[16]=d,f[17]=m):m=f[17],f[18]!==a.title?(h=(0,r.jsx)(eT.A,{title:a.title,maxWidth:350,children:a.title}),f[18]=a.title,f[19]=h):h=f[19],f[20]!==a.number?(p=(0,r.jsxs)(u.l.Description,{children:["#",a.number]}),f[20]=a.number,f[21]=p):p=f[21],f[22]!==n||f[23]!==o||f[24]!==m||f[25]!==h||f[26]!==p?(g=(0,r.jsxs)(u.l.Item,{...n,className:o,children:[m,h,p]}),f[22]=n,f[23]=o,f[24]=m,f[25]=h,f[26]=p,f[27]=g):g=f[27],g}try{e3.displayName||(e3.displayName="IssueSuggestion")}catch{}function e4(e){let t,a,n,s,o,l,c,d,m,h,p,g,f=(0,i.c)(28);f[0]!==e?({pullRequest:n,stale:s,className:t,...a}=e,f[0]=e,f[1]=t,f[2]=a,f[3]=n,f[4]=s):(t=f[1],a=f[2],n=f[3],s=f[4]);let y=s&&e1.stale;return f[5]!==t||f[6]!==y?(o=(0,C.$)(e1.asyncSuggestion,y,t),f[5]=t,f[6]=y,f[7]=o):o=f[7],f[8]!==n.state?(l="draft"===n.state&&(0,r.jsx)(T.GitPullRequestDraftIcon,{className:"fgColor-draft"}),f[8]=n.state,f[9]=l):l=f[9],f[10]!==n.state?(c="open"===n.state&&(0,r.jsx)(T.GitPullRequestIcon,{className:"fgColor-open"}),f[10]=n.state,f[11]=c):c=f[11],f[12]!==n.state?(d="closed"===n.state&&(0,r.jsx)(T.GitPullRequestClosedIcon,{className:"fgColor-done"}),f[12]=n.state,f[13]=d):d=f[13],f[14]!==l||f[15]!==c||f[16]!==d?(m=(0,r.jsxs)(u.l.LeadingVisual,{children:[l,c,d]}),f[14]=l,f[15]=c,f[16]=d,f[17]=m):m=f[17],f[18]!==n.title?(h=(0,r.jsx)(eT.A,{title:n.title,maxWidth:350,children:n.title}),f[18]=n.title,f[19]=h):h=f[19],f[20]!==n.number?(p=(0,r.jsxs)(u.l.Description,{children:["#",n.number]}),f[20]=n.number,f[21]=p):p=f[21],f[22]!==a||f[23]!==o||f[24]!==m||f[25]!==h||f[26]!==p?(g=(0,r.jsxs)(u.l.Item,{...a,className:o,children:[m,h,p]}),f[22]=a,f[23]=o,f[24]=m,f[25]=h,f[26]=p,f[27]=g):g=f[27],g}try{e4.displayName||(e4.displayName="PullRequestSuggestion")}catch{}function e7(e){let t,a,n,s,o,l,c,d,m=(0,i.c)(18);m[0]!==e?({repository:s,isMultistep:a,stale:o,className:t,...n}=e,m[0]=e,m[1]=t,m[2]=a,m[3]=n,m[4]=s,m[5]=o):(t=m[1],a=m[2],n=m[3],s=m[4],o=m[5]);let h=o&&e1.stale;m[6]!==t||m[7]!==h?(l=(0,C.$)(e1.asyncSuggestion,h,t),m[6]=t,m[7]=h,m[8]=l):l=m[8];let p=l;m[9]!==s.isInOrganization||m[10]!==s.ownerAvatarUrl?(c=s.ownerAvatarUrl?(0,r.jsx)(em.r,{src:s.ownerAvatarUrl,alt:"",size:16,square:s.isInOrganization}):(0,r.jsx)(T.RepoIcon,{}),m[9]=s.isInOrganization,m[10]=s.ownerAvatarUrl,m[11]=c):c=m[11];let g=c;return m[12]!==g||m[13]!==p||m[14]!==a||m[15]!==n||m[16]!==s.nwo?(d=a?(0,r.jsx)(eX,{...n,className:p,leadingVisual:g,children:s.nwo},s.nwo):(0,r.jsxs)(u.l.Item,{...n,className:p,children:[(0,r.jsx)(u.l.LeadingVisual,{children:g}),s.nwo]},s.nwo),m[12]=g,m[13]=p,m[14]=a,m[15]=n,m[16]=s.nwo,m[17]=d):d=m[17],d}try{e7.displayName||(e7.displayName="RepositorySuggestion")}catch{}function e6(e){return{value:null,key:e.value,render:t=>(0,r.jsx)(e0,{category:e,...t})}}function e8(e){return null!==e}var e9=a(84331);function te(e){return{value:`/${e.key}`,key:e.key,render:t=>(0,r.jsxs)(u.l.Item,{...t,children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(e.icon,{})}),e.name,(0,r.jsx)(u.l.Description,{variant:"block",children:e.description})]})}}var tt=a(97286);function ta(e){let t,a,n=(0,i.c)(3),[r,s]=(0,m.useState)(null);return(null===r&&null!==e||null!==r&&null===e)&&s(e),n[0]!==e?(t=()=>{let t=setTimeout(()=>s(e),200);return()=>clearTimeout(t)},a=[e],n[0]=e,n[1]=t,n[2]=a):(t=n[1],a=n[2]),(0,m.useEffect)(t,a),r}function tn(e){return e}async function tr(e,t,a,n){return new Promise((r,i)=>{if(!window.Worker)return void setTimeout(()=>r(e.filter(e=>e.includes(t))));let s=new Worker(a);s.addEventListener("message",e=>r(e.data.list)),s.addEventListener("error",e=>i(Error(`Worker error: ${e.message}`))),n.addEventListener("abort",()=>{s.terminate(),i(Error("Worker aborted"))}),s.postMessage({baseList:e,query:t})})}function ti(e){return e}function ts(e){return e}function to(e){return e}var tl=a(26408);function tc(e){let t,a,n,s,o=(0,i.c)(9);return o[0]!==e?({org:t,...a}=e,o[0]=e,o[1]=t,o[2]=a):(t=o[1],a=o[2]),o[3]!==t.avatarUrl?(n=(0,r.jsx)(em.r,{square:!0,src:t.avatarUrl}),o[3]=t.avatarUrl,o[4]=n):n=o[4],o[5]!==t.login||o[6]!==a||o[7]!==n?(s=(0,r.jsx)(eJ,{leadingVisual:n,...a,children:t.login}),o[5]=t.login,o[6]=a,o[7]=n,o[8]=s):s=o[8],s}function td(e){let t,a,n,s=(0,i.c)(7);return s[0]!==e?({orgs:t,...a}=e,s[0]=e,s[1]=t,s[2]=a):(t=s[1],a=s[2]),s[3]!==t[0]?.login||s[4]!==t.length||s[5]!==a?(n=1===t.length?(0,r.jsxs)(eJ,{leadingVisual:(0,r.jsx)(T.ShieldLockIcon,{}),...a,children:["Single sign-on to ",(0,r.jsx)("strong",{children:t[0]?.login})," for more"]}):(0,r.jsx)(eX,{leadingVisual:(0,r.jsx)(T.ShieldLockIcon,{}),...a,children:"Single sign-on for more"}),s[3]=t[0]?.login,s[4]=t.length,s[5]=a,s[6]=n):n=s[6],n}try{tc.displayName||(tc.displayName="SSOOrgSuggestion")}catch{}try{td.displayName||(td.displayName="SSOPromptSuggestion")}catch{}let tu=e=>`/orgs/${encodeURIComponent(e.login)}/sso?return_to=${encodeURIComponent(location.href)}`;function tm(e){return{value:null,key:`open-link:${tu(e)}`,render:t=>(0,r.jsx)(tc,{org:e,...t})}}function th(e){let t,a,n,o,l,c,d,h,p,f,y,x,v=(0,i.c)(32),{children:C,onSelectCommand:_,onSelectReference:S,onShowAgentsDialog:b,hideAutocomplete:w,availableCommands:N}=e,{mode:I}=(0,g.Pk)();v[0]===Symbol.for("react.memo_cache_sentinel")?(t=[{triggerChar:"@",insertSpaceOnCommit:!0,keepTriggerCharOnCommit:!1,multiWord:!0}],j.W.chatInputCommands&&t.push({triggerChar:"/",insertSpaceOnCommit:!0,keepTriggerCharOnCommit:!1,multiWord:!1}),v[0]=t):t=v[0];let[E,A]=(0,m.useState)(tp);v[1]===Symbol.for("react.memo_cache_sentinel")?(a=()=>A(!0),n=[],v[1]=a,v[2]=n):(a=v[1],n=v[2]),(0,m.useEffect)(a,n);let[R,k]=(0,m.useState)(null);v[3]!==N||v[4]!==R?(o={query:R,availableCommands:N},v[3]=N,v[4]=R,v[5]=o):o=v[5];let{suggestions:L,stale:P}=function(e){let t=(0,i.c)(9),{query:a,availableCommands:n}=e,s=function(e,t){let a,n=(0,i.c)(5);e:{let r,i;if(!t){a=null;break e}n[0]!==e||n[1]!==t.filter?(r=""===t.filter.trim()?e:e.filter(e=>(0,e9.dt)(e.name,t.filter)>.5&&e.key!==t.filter.toLowerCase()),n[0]=e,n[1]=t.filter,n[2]=r):r=n[2];let s=r;n[3]!==s?(i=s.map(te),n[3]=s,n[4]=i):i=n[4],a=i}return a}(n,a?.category==="commands"?a:null),o=function(e){let t,a=(0,i.c)(3),{currentReferences:n}=(0,g.Pk)();e:{let i;if(!e){t=null;break e}if(a[0]!==n||a[1]!==e){let t=e.filter.toLowerCase(),s=e=>e.toLowerCase().includes(t)&&e.toLowerCase()!==t,o=n.map(e=>{let t=B.Q.for(e);switch(t?.type){case void 0:break;case"repository":{let e=`${t.reference.ownerLogin}/${t.reference.name}`;if(!s(e))return null;return{value:B.Q.stringify(t),render:a=>(0,r.jsx)(e7,{repository:{databaseId:t.reference.id,isInOrganization:"Organization"===t.reference.ownerType,name:t.reference.name,nwo:e,ownerLogin:t.reference.ownerLogin},...a})}}case"issue":{let e=t.reference.title??"";if(!s(e))return null;return{value:B.Q.stringify(t),render:a=>(0,r.jsx)(e3,{issue:{number:t.reference.number,state:t.reference.state??"",title:e},...a})}}case"pull-request":{let e=t.reference.title??"";if(!s(e))return null;return{value:B.Q.stringify(t),render:a=>(0,r.jsx)(e4,{pullRequest:{number:t.reference.number,state:t.reference.state??"",title:e},...a})}}case"discussion":{let e=t.reference.title??"";if(!s(e))return null;return{value:B.Q.stringify(t),render:a=>(0,r.jsx)(e2,{discussion:{number:t.reference.number,state:t.reference.state,title:e},...a})}}case"file":{let e=t.reference.path;if(!s(e))return null;return{value:B.Q.stringify(t),render:a=>(0,r.jsx)(e5,{type:"folder"===t.reference.type?"folder":"file",path:e,...a})}}}return null}).filter(e8),l=(j.W.hideExtensionsInDotcomChat?eG.filter(e=>"agents"!==e.value):eG).filter(a=>a.name.toLowerCase().includes(t)&&function(e,t){switch(e){case"start":return 0===t.index;case"anywhere":return!0}}(a.where,e)).map(e6);if(l.length>0){let e=o.at(-1);if(e&&"object"==typeof e){let t=e.render;e.render=e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t,{...e}),(0,r.jsx)(u.l.Divider,{})]})}}i=o.concat(l),a[0]=n,a[1]=e,a[2]=i}else i=a[2];t=i}return t}(a?.category==="categories"?a:null),l=function(e){let t,a=(0,i.c)(4),{availableAgents:n,loading:s,showLimit:o,disabled:l}=(0,eu.JE)(null!==e);e:{let i;if(l||!e){t=null;break e}if(s&&!n){t="loading";break e}a[0]!==n||a[1]!==e||a[2]!==o?(i=n?.filter(t=>e?.category==="agents"&&t.name.toLowerCase().includes(e.filter.toLowerCase())).map(eY).concat({value:null,key:`open-link:${eu.bn}`,render:e=>(0,r.jsxs)(r.Fragment,{children:[n.length>0&&(0,r.jsx)(u.l.Divider,{}),(0,r.jsx)(eJ,{leadingVisual:(0,r.jsx)(T.TelescopeIcon,{}),...e,inactiveText:o?"Start a new conversation to use other extensions.":void 0,children:"Marketplace"})]})})??null,a[0]=n,a[1]=e,a[2]=o,a[3]=i):i=a[3],t=i}return t}(a?.category==="agents"?a:null),c=function(e){let{currentReferences:t}=(0,g.Pk)(),a=ta(e),n=e!==a,{repositories:i,loading:s}=(0,tl.U)(a?.filter??"",null!==a),o=(0,m.useMemo)(()=>new Set(t.filter(e=>"repository"===e.type).map(e=>e.id)),[t]),{ssoOrganizations:l}=(0,g.Pk)();return{suggestions:(0,m.useMemo)(()=>{if(!a)return null;if("initial"===s)return"loading";let e=void 0!==a.nextCategory,t=i.toSorted((e,t)=>o.has(e.databaseId)&&!o.has(t.databaseId)?-1:o.has(t.databaseId)&&!o.has(e.databaseId)?1:0).slice(0,5).map(t=>({value:e?null:B.Q.stringify({type:"repository",repo:t.nwo}),key:t.nwo,render:a=>(0,r.jsx)(e7,{repository:t,isMultistep:e,stale:!!s||n,...a})}))??[];return l.length>0&&t.push({value:null,key:1===l.length?`open-link:${tu(l[0])}`:"sso-orgs",render:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.l.Divider,{}),(0,r.jsx)(td,{orgs:l,...e})]})}),t},[i,s,a,o,l,n]),stale:!0===s}}(a?.category==="repositories"?a:null),d=function(e){let t,a,n,s,o,l=(0,i.c)(18),{service:c}=(0,F.b)(),d=ta(e),u=e!==d,m=null!==d,h=d?.repository,p=d?.filter;l[0]!==h||l[1]!==p?(t=["copilot-autocomplete-issues",h,p],l[0]=h,l[1]=p,l[2]=t):t=l[2],l[3]!==d||l[4]!==c?(a=async()=>c.fetchAutocompleteIssues(d.repository,d.filter),l[3]=d,l[4]=c,l[5]=a):a=l[5],l[6]!==m||l[7]!==t||l[8]!==a?(n={enabled:m,queryKey:t,queryFn:a,placeholderData:ts},l[6]=m,l[7]=t,l[8]=a,l[9]=n):n=l[9];let g=(0,tt.I)(n);e:{let e;if(!d){s=null;break e}if(g.isLoading){s="loading";break e}l[10]!==d||l[11]!==u||l[12]!==g.data||l[13]!==g.isPlaceholderData?(e=g.data?.map(e=>({value:B.Q.stringify({type:"issue",repo:d.repository,id:e.number.toString()}),key:e.number.toString(),render:t=>(0,r.jsx)(e3,{...t,issue:e,stale:g.isPlaceholderData||u})}))??null,l[10]=d,l[11]=u,l[12]=g.data,l[13]=g.isPlaceholderData,l[14]=e):e=l[14],s=e}let f=s;return l[15]!==g.isPlaceholderData||l[16]!==f?(o={suggestions:f,stale:g.isPlaceholderData},l[15]=g.isPlaceholderData,l[16]=f,l[17]=o):o=l[17],o}(a?.category==="issues"?a:null),h=function(e){let t,a,n,s,o,l=(0,i.c)(18),{service:c}=(0,F.b)(),d=ta(e),u=e!==d,m=null!==d,h=d?.repository,p=d?.filter;l[0]!==h||l[1]!==p?(t=["copilot-autocomplete-pulls",h,p],l[0]=h,l[1]=p,l[2]=t):t=l[2],l[3]!==d||l[4]!==c?(a=async()=>c.fetchAutocompletePullRequests(d.repository,d.filter),l[3]=d,l[4]=c,l[5]=a):a=l[5],l[6]!==m||l[7]!==t||l[8]!==a?(n={enabled:m,queryKey:t,queryFn:a,placeholderData:to},l[6]=m,l[7]=t,l[8]=a,l[9]=n):n=l[9];let g=(0,tt.I)(n);e:{let e;if(!d){s=null;break e}if(g.isLoading){s="loading";break e}l[10]!==d||l[11]!==u||l[12]!==g.data||l[13]!==g.isPlaceholderData?(e=g.data?.map(e=>({value:B.Q.stringify({type:"pull-request",repo:d.repository,id:e.number.toString()}),key:e.number.toString(),render:t=>(0,r.jsx)(e4,{...t,pullRequest:e,stale:g.isPlaceholderData||u})}))??null,l[10]=d,l[11]=u,l[12]=g.data,l[13]=g.isPlaceholderData,l[14]=e):e=l[14],s=e}let f=s;return l[15]!==g.isPlaceholderData||l[16]!==f?(o={suggestions:f,stale:g.isPlaceholderData},l[15]=g.isPlaceholderData,l[16]=f,l[17]=o):o=l[17],o}(a?.category==="pulls"?a:null),p=function(e){let t,a,n,s,o,l=(0,i.c)(18),{service:c}=(0,F.b)(),d=ta(e),u=e!==d,m=null!==d,h=d?.repository,p=d?.filter;l[0]!==h||l[1]!==p?(t=["copilot-autocomplete-discussions",h,p],l[0]=h,l[1]=p,l[2]=t):t=l[2],l[3]!==d||l[4]!==c?(a=async()=>c.fetchAutocompleteDiscussions(d.repository,d.filter),l[3]=d,l[4]=c,l[5]=a):a=l[5],l[6]!==m||l[7]!==t||l[8]!==a?(n={enabled:m,queryKey:t,queryFn:a,placeholderData:tn},l[6]=m,l[7]=t,l[8]=a,l[9]=n):n=l[9];let g=(0,tt.I)(n);e:{let e;if(!d){s=null;break e}if(g.isLoading){s="loading";break e}l[10]!==d||l[11]!==g.data||l[12]!==g.isPlaceholderData||l[13]!==u?(e=g.data?.map(e=>({value:B.Q.stringify({type:"discussion",repo:d.repository,id:e.number.toString()}),key:e.number.toString(),render:t=>(0,r.jsx)(e2,{...t,discussion:e,stale:g.isPlaceholderData||u})}))??null,l[10]=d,l[11]=g.data,l[12]=g.isPlaceholderData,l[13]=u,l[14]=e):e=l[14],s=e}let f=s;return l[15]!==g.isPlaceholderData||l[16]!==f?(o={suggestions:f,stale:g.isPlaceholderData},l[15]=g.isPlaceholderData,l[16]=f,l[17]=o):o=l[17],o}(a?.category==="discussions"?a:null),f=function(e){let t,a,n,s,o,l,c,d,u=(0,i.c)(23),m=(0,F.b)(),h=null!==e,p=e?.repository;u[0]!==p?(t=["copilot-repository",p],u[0]=p,u[1]=t):t=u[1],u[2]!==m||u[3]!==e?.repository?(a=async()=>{if(!e?.repository)return null;let t=await m.service.fetchRepo(e?.repository);if(!t.ok)throw Error("Failed to fetch repository");return t.payload},u[2]=m,u[3]=e?.repository,u[4]=a):a=u[4],u[5]!==h||u[6]!==t||u[7]!==a?(n={enabled:h,queryKey:t,queryFn:a,staleTime:3e5},u[5]=h,u[6]=t,u[7]=a,u[8]=n):n=u[8];let f=(0,tt.I)(n),y=function(e,t){let a,n,r,s=(0,i.c)(11),o=(0,F.b)(),l=null!==e;return!0!==s[0]||s[1]!==e?(a=["copilot-repository-files",e,!0],s[0]=!0,s[1]=e,s[2]=a):a=s[2],!0!==s[3]||s[4]!==o||s[5]!==e?(n=async()=>{if(!e)return{};let t=await o.service.listRepoFiles(e,!0);if(!t.ok)throw Error("Failed to fetch files for repository");return t.payload},s[3]=!0,s[4]=o,s[5]=e,s[6]=n):n=s[6],s[7]!==l||s[8]!==a||s[9]!==n?(r={enabled:l,queryKey:a,queryFn:n,staleTime:3e5},s[7]=l,s[8]=a,s[9]=n,s[10]=r):r=s[10],(0,tt.I)(r)}(f.data??null);y.data?.directories,u[9]!==y.data?.directories?(s=y.data?.directories??[],u[9]=y.data?.directories,u[10]=s):s=u[10],u[11]!==s?(o=new Set(s),u[11]=s,u[12]=o):o=u[12];let x=o;u[13]!==y.data?(l=y.data?(y.data.paths??[]).concat(y.data.directories??[]):null,u[13]=y.data,u[14]=l):l=u[14];let v=function(e,t){let a,n,r,s=(0,i.c)(9),{findFileWorkerPath:o}=(0,g.Pk)();s[0]!==e||s[1]!==t||s[2]!==o?(a=["copilot-worker-filter",o,e,t],n=async a=>{let{signal:n}=a;return e?0===t.length?e:tr(e,t,o,n):[]},s[0]=e,s[1]=t,s[2]=o,s[3]=a,s[4]=n):(a=s[3],n=s[4]);let l=null!==e;return s[5]!==a||s[6]!==n||s[7]!==l?(r={queryKey:a,queryFn:n,enabled:l,staleTime:1/0,gcTime:1e4,networkMode:"always",retry:!1,placeholderData:ti},s[5]=a,s[6]=n,s[7]=l,s[8]=r):r=s[8],(0,tt.I)(r)}(l,e?.filter??"");e:{let t;if(!e){c=null;break e}if(f.isLoading||y.isLoading||v.isLoading){c="loading";break e}u[15]!==x||u[16]!==v.data||u[17]!==v.isPlaceholderData||u[18]!==e?(t=[...v.data?.slice(0,5).map(t=>({value:B.Q.stringify({repo:e.repository,type:"file",id:t}),key:t,render:e=>(0,r.jsx)(e5,{...e,path:t,type:x.has(t)?"folder":"file",stale:v.isPlaceholderData})}))??[]],u[15]=x,u[16]=v.data,u[17]=v.isPlaceholderData,u[18]=e,u[19]=t):t=u[19];let a=t;c=a.length>0?a:null}let C=c;return u[20]!==f.isPlaceholderData||u[21]!==C?(d={suggestions:C,stale:f.isPlaceholderData},u[20]=f.isPlaceholderData,u[21]=C,u[22]=d):d=u[22],d}(a?.category==="files"?a:null),y=function(e){let t,a=(0,i.c)(5),{ssoOrganizations:n}=(0,g.Pk)();e:{let r;if(!e){t=null;break e}if(a[0]!==e||a[1]!==n){let t;a[3]!==e?(t=t=>t.login.toLowerCase().includes(e.filter.toLowerCase()),a[3]=e,a[4]=t):t=a[4],r=n.filter(t).slice(0,10).map(tm),a[0]=e,a[1]=n,a[2]=r}else r=a[2];t=r}return t}(a?.category==="sso-orgs"?a:null);switch(a?.category){case"commands":{let e;return t[0]!==s?(e={suggestions:s,stale:!1},t[0]=s,t[1]=e):e=t[1],e}case void 0:{let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e={suggestions:null,stale:!1},t[2]=e):e=t[2],e}case"categories":{let e;return t[3]!==o?(e={suggestions:o,stale:!1},t[3]=o,t[4]=e):e=t[4],e}case"repositories":return c;case"issues":return d;case"agents":{let e;return t[5]!==l?(e={suggestions:l,stale:!1},t[5]=l,t[6]=e):e=t[6],e}case"discussions":return p;case"pulls":return h;case"files":return f;case"sso-orgs":{let e;return t[7]!==y?(e={suggestions:y,stale:!1},t[7]=y,t[8]=e):e=t[8],e}}}(o);if(v[6]!==b||v[7]!==R?(l={query:R,onShowAgentsDialog:b},v[6]=b,v[7]=R,v[8]=l):l=v[8],!function(e){let t,a,n=(0,i.c)(12),{query:r,onShowAgentsDialog:s}=e,o=r?.category==="agents",{availableAgents:l,loading:c,disabled:d}=(0,eu.JE)(o);n[0]!==o||n[1]!==l?.length||n[2]!==d||n[3]!==c||n[4]!==s?(t=()=>{o&&!c&&(d?s("agents-not-supported"):l?.length||s("no-agents-available"))},n[0]=o,n[1]=l?.length,n[2]=d,n[3]=c,n[4]=s,n[5]=t):t=n[5],n[6]!==o||n[7]!==l||n[8]!==d||n[9]!==c||n[10]!==s?(a=[o,c,l,d,s],n[6]=o,n[7]=l,n[8]=d,n[9]=c,n[10]=s,n[11]=a):a=n[11],(0,m.useEffect)(t,a)}(l),!E||w){let e;return v[9]!==C?(e=(0,r.jsx)("div",{children:C}),v[9]=C,v[10]=e):e=v[10],e}v[11]!==I||v[12]!==_||v[13]!==S||v[14]!==R?(c=e=>{let{suggestion:t}=e,a="string"==typeof t?t:t.value;if((0,s.BI)("dotcom_chat.activate",{target:"AUTOCOMPLETE_ITEM_SELECTED",mode:I,suggestion:a}),"object"==typeof t&&R?.category==="commands")return void _?.(t.key);let n=null!==a&&R?.category!=="agents"?B.Q.parse(a):void 0;if(n&&S(n),"object"!=typeof t||null!==t.value)return;let r=/^open-link:(.+)$/.exec(t.key);if(r){k(null),window.open(r[1],"_blank");return}switch(R?.category){case"categories":eQ.is(t.key)&&k(function(e){switch(e){case"repositories":return{category:"repositories",filter:""};case"agents":return{category:"agents",filter:""};case"repositories:discussions":return{category:"repositories",filter:"",nextCategory:"discussions"};case"repositories:issues":return{category:"repositories",filter:"",nextCategory:"issues"};case"repositories:pulls":return{category:"repositories",filter:"",nextCategory:"pulls"};case"repositories:files":return{category:"repositories",filter:"",nextCategory:"files"}}}(t.key));break;case"repositories":"sso-orgs"===t.key?k({category:"sso-orgs",filter:""}):R.nextCategory&&k({category:R.nextCategory,filter:"",repository:t.key})}},v[11]=I,v[12]=_,v[13]=S,v[14]=R,v[15]=c):c=v[15];let M=c;v[16]!==R?(d=e=>{if("/"===e.trigger.triggerChar){(null===R&&1===e.target.selectionStart&&1===e.target.selectionEnd||R?.category==="commands")&&k({category:"commands",filter:e.query});return}k(t=>t?{...t,filter:e.query}:{category:"categories",filter:e.query,index:(e.target.selectionStart??0)-(e.query.length+e.trigger.triggerChar.length)})},v[16]=R,v[17]=d):d=v[17];let O=d;v[18]===Symbol.for("react.memo_cache_sentinel")?(h=()=>k(null),v[18]=h):h=v[18];let D=h;return v[19]!==R?(p=R&&function(e){switch(e.category){case"categories":case"commands":return null;case"repositories":switch(e.nextCategory){case"discussions":case"issues":case"pulls":case"files":return`${eK[e.nextCategory]} \u{203A}`;default:return"Repositories \u203A"}case"agents":return eK[e.category];case"discussions":case"issues":case"pulls":case"files":return`${eK[e.category]} \u{203A} ${e.repository} \u{203A}`;case"sso-orgs":return"Single sign-on"}}(R)||void 0,v[19]=R,v[20]=p):p=v[20],v[21]!==C||v[22]!==M||v[23]!==O||v[24]!==L||v[25]!==p?(f=(0,r.jsx)(eq.a,{fullWidth:!0,suggestions:L,triggers:t,tabInsertsSuggestions:!1,onHideSuggestions:D,onShowSuggestions:O,onSelectSuggestion:M,suggestionsPlacement:"below",title:p,asMenu:!0,children:C}),v[21]=C,v[22]=M,v[23]=O,v[24]=L,v[25]=p,v[26]=f):f=v[26],v[27]!==P?(y=P&&(0,r.jsx)("span",{role:"status","aria-live":"polite",className:"sr-only",children:"Loading"}),v[27]=P,v[28]=y):y=v[28],v[29]!==y||v[30]!==f?(x=(0,r.jsxs)(r.Fragment,{children:[f,y]}),v[29]=y,v[30]=f,v[31]=x):x=v[31],x}function tp(){return"undefined"!=typeof document}try{th.displayName||(th.displayName="ChatInputAutocomplete")}catch{}let tg={container:"ChatInput-module__container--qmP6j",input:"ChatInput-module__input--HalEQ",containerDisabled:"ChatInput-module__containerDisabled--bIHy2",toolbar:"ChatInput-module__toolbar--Kv3Gl",containerSmall:"ChatInput-module__containerSmall--NfPkF",inputContainer:"ChatInput-module__inputContainer--cpjba",inputPreview:"ChatInput-module__inputPreview--Fdwj0",clicked:"ChatInput-module__clicked--u0igo",attachments:"ChatInput-module__attachments--Fv007",attachmentButton:"ChatInput-module__attachmentButton--qtFf6",attachmentButtonText:"ChatInput-module__attachmentButtonText--fVuEs",inputContainerNewConversation:"ChatInput-module__inputContainerNewConversation--FexlN",toolbarNoModes:"ChatInput-module__toolbarNoModes--KJL2k",extra:"ChatInput-module__extra--oQVm8",CommandIconButton:"ChatInput-module__CommandIconButton--lxm7H",mode:"ChatInput-module__mode--dH9c4",modeButton:"ChatInput-module__modeButton--y5Yp0",modeSelectButton:"ChatInput-module__modeSelectButton--rJ86j",modeSelectorMobile:"ChatInput-module__modeSelectorMobile--ZPCVa",modeSelectorDesktop:"ChatInput-module__modeSelectorDesktop--SifXL",actions:"ChatInput-module__actions--zbM52",actionsMultiple:"ChatInput-module__actionsMultiple--LHDC3",toolbarButtons:"ChatInput-module__toolbarButtons--YDoIY",lighterSegmentedControl:"ChatInput-module__lighterSegmentedControl--uAdMt"};var tf=a(16378),ty=a(6224);let tx=(0,m.forwardRef)(function(e,t){let a,n,s,o=(0,i.c)(8),{text:l,availableCommandKeys:c}=e;o[0]!==l?(a=(0,tf._)(l),o[0]=l,o[1]=a):a=o[1];let{availableAgents:d}=(0,eu.JE)(a),{currentReferences:u}=(0,g.Pk)(),h=(0,F.b)(),p=(0,O.l)().use($.U,{references:u,agents:void 0===d?[]:d,commands:c}).parse(l),f=(0,tf.O)(p),y=(0,m.useRef)(f);(0,m.useEffect)(function(){for(let e of y.current)if(!f.has(e)){let t=u.find(t=>(0,v.Vb)(t)===e);t&&h.removeReference(t)}y.current=f}),o[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,N.G)("copilot-chat-input-textarea-preview"),o[2]=n):n=o[2];let x=p.children.map(tv);return o[3]!==t||o[4]!==n||o[5]!==tg.inputPreview||o[6]!==x?(s=(0,r.jsx)("div",{id:"copilot-chat-textarea-preview",...n,"aria-hidden":!0,className:tg.inputPreview,ref:t,role:"presentation",children:x}),o[3]=t,o[4]=n,o[5]=tg.inputPreview,o[6]=x,o[7]=s):s=o[7],s});try{tx.displayName||(tx.displayName="ChatInputPreview")}catch{}function tv(e,t){switch(e.type){case"text":return e.value;case"command":return(0,r.jsx)("span",{className:ty.A.command,...(0,N.G)("input-preview-command"),children:e.value},t);case"reference-mention":return void 0!==e.data.mentionedReferenceId?(0,r.jsx)("span",{className:ty.A.mention,...(0,N.G)("input-preview-ref"),children:e.value},t):e.value;case"agent-mention":return(0,r.jsx)("span",{className:ty.A.mention,children:e.value},t)}}var tC=a(11683),t_=a(45800),tS=a(25536),tb=a(7730),tj=a(57448);let tw={container:"ChatInputReferences-module__container--bNybl",attachmentsList:"ChatInputReferences-module__attachmentsList--mEJpJ",scrolledToEnd:"ChatInputReferences-module__scrolledToEnd--DONiv",loading:"ChatInputReferences-module__loading--kAJlw",divider:"ChatInputReferences-module__divider--k8d6S",menuButton:"ChatInputReferences-module__menuButton--IVLqN",functionLoading:"ChatInputReferences-module__functionLoading--Oimop",convertToFileContainer:"ChatInputReferences-module__convertToFileContainer--y1XOU",convertToFileButton:"ChatInputReferences-module__convertToFileButton--hnPn2"};var tN=a(1631),tI=a(15518);let tE=(0,m.memo)(e=>{let t,a,n,s,o,c,h,p,f,y,x,_,S,b,j,w,I,E=(0,i.c)(51),{className:A,isLoading:R,returnFocusRef:P,tokenSize:M,onSelectReference:O,getReferenceVersion:D,showConvertToFileText:B,onConvertToFile:$,onConvertToFileDismiss:z,hideAttachmentsMenu:U,onRemoveReference:W}=e,V=void 0===M?"medium":M,{currentReferences:H}=(0,g.Pk)(),K=(0,F.b)(),G=(0,m.useRef)(null),Q=(0,tb.g)(G),[Z,J]=(0,m.useState)(!1);E[0]!==H?(t=(0,v.rT)(H),E[0]=H,E[1]=t):t=E[1];let Y=t,{setSelectedCopilotSpaceId:X}=(0,tS.O)(),ee=(0,m.useRef)(null);E[2]===Symbol.for("react.memo_cache_sentinel")?(a={containerRef:ee,focusableElementFilter:tA,bindKeys:tC.z0.ArrowHorizontal|tC.z0.HomeAndEnd,focusInStrategy:"previous",focusOutBehavior:"stop"},E[2]=a):a=E[2],E[3]!==Y?(n=[Y],E[3]=Y,E[4]=n):n=E[4],(0,t_.G)(a,n),E[5]===Symbol.for("react.memo_cache_sentinel")?(s=[],E[5]=s):s=E[5];let et=(0,m.useRef)(s),ea=(e,t)=>{let a=et.current[t+1]??et.current[t-1]??P.current;a?.focus(),W?.(e),(0,v.yA)(e)&&X(void 0),K.removeReference(e)};E[6]!==K||E[7]!==P||E[8]!==Y||E[9]!==X?(o=()=>{setTimeout(()=>P.current?.focus()),Y.filter(v.yA).length>0&&X(void 0),K.clearCurrentReferences()},E[6]=K,E[7]=P,E[8]=Y,E[9]=X,E[10]=o):o=E[10];let en=o,er=(0,m.useRef)(Y);E[11]!==Y?(c=()=>{if(er.current.length!er.current.find(t=>(0,v.x_)(t,e))),t=e?Y.indexOf(e):-1;et?.current?.[t]?.scrollIntoView({behavior:"smooth",block:"nearest",inline:"end"})}er.current=Y},h=[Y],E[11]=Y,E[12]=c,E[13]=h):(c=E[12],h=E[13]),(0,q.N)(c,h),E[14]!==z?(p=()=>{z?.()},E[14]=z,E[15]=p):p=E[15];let ei=p;E[16]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{J(tR)},E[16]=f):f=E[16];let es=f,eo=function(e,t,a,n){let r,s,o,l,c,d=(0,i.c)(14),[u,h]=(0,m.useState)(!1);d[0]!==n||d[1]!==t?(r=()=>{t.current&&h(t.current.some(e=>{if(!e)return!1;let t=e.querySelector(n);return!!t&&t.scrollWidth>t.clientWidth}))},d[0]=n,d[1]=t,d[2]=r):r=d[2];let p=r;return d[3]!==p||d[4]!==e.length?(s=()=>{if(0===e.length)return void h(!1);let t=requestAnimationFrame(p);return()=>cancelAnimationFrame(t)},d[3]=p,d[4]=e.length,d[5]=s):s=d[5],d[6]!==p||d[7]!==e?(o=[e,p],d[6]=p,d[7]=e,d[8]=o):o=d[8],(0,m.useEffect)(s,o),d[9]!==p||d[10]!==a||d[11]!==e.length?(l=()=>{if(0===e.length||!a.current)return;let t=new ResizeObserver(()=>{p()});return t.observe(a.current),()=>{t.disconnect()}},c=[e.length,p,a],d[9]=p,d[10]=a,d[11]=e.length,d[12]=l,d[13]=c):(l=d[12],c=d[13]),(0,m.useEffect)(l,c),u}(Y,et,ee,`.${tI.A.name}`),el=(0,m.useId)();E[17]!==ei||E[18]!==B?(y=e=>{("Delete"===e.key||"Backspace"===e.key)&&(e.preventDefault(),e.stopPropagation(),B&&ei())},E[17]=ei,E[18]=B,E[19]=y):y=E[19];let ec=y;if(0===Y.length&&!R&&!B)return null;E[20]!==A?(x=(0,C.$)(A,tw.container),E[20]=A,E[21]=x):x=E[21];let ed=Q&&tw.scrolledToEnd,eu=R&&tw.loading;E[22]!==ed||E[23]!==eu?(_=(0,C.$)(tw.attachmentsList,ed,eu),E[22]=ed,E[23]=eu,E[24]=_):_=E[24],E[25]!==el||E[26]!==ei||E[27]!==$||E[28]!==ec||E[29]!==B||E[30]!==V?(S=B&&(0,r.jsxs)("div",{className:tw.convertToFileContainer,children:[(0,r.jsx)(k.Q,{onClick:$,leadingVisual:T.FileIcon,className:tw.convertToFileButton,"aria-describedby":el,onKeyDown:ec,children:"Convert to file"}),(0,r.jsx)(tN.lh,{size:V,onRemove:ei,descriptionId:el})]}),E[25]=el,E[26]=ei,E[27]=$,E[28]=ec,E[29]=B,E[30]=V,E[31]=S):S=E[31];let em=Y.map((e,t)=>"repository"===e.type?(0,r.jsx)(tT,{reference:e,ref:e=>{et.current[t]=e},"data-index":t,size:V,fullWidth:Z,onRemove:()=>ea(e,t),onClick:O,getReferenceVersion:D},(0,v.Vb)(e)):(0,r.jsx)(tN.BR,{reference:e,ref:e=>{et.current[t]=e},"data-index":t,size:V,fullWidth:Z,onRemove:()=>ea(e,t),onClick:O,getReferenceVersion:D},(0,v.Vb)(e)));return E[32]!==R?(b=R&&(0,r.jsxs)("div",{className:tw.functionLoading,...(0,N.G)("loading-indicator"),children:[(0,r.jsx)(d.A,{size:"small"}),"Retrieving\u2026"]}),E[32]=R,E[33]=b):b=E[33],E[34]!==_||E[35]!==S||E[36]!==em||E[37]!==b?(j=(0,r.jsxs)("div",{className:_,ref:G,children:[S,em,b]}),E[34]=_,E[35]=S,E[36]=em,E[37]=b,E[38]=j):j=E[38],E[39]!==es||E[40]!==eo||E[41]!==U||E[42]!==en||E[43]!==Y.length||E[44]!==Z||E[45]!==V?(w=Y.length>0&&!U&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:tw.divider}),(0,r.jsxs)(l.W,{children:[(0,r.jsx)(l.W.Anchor,{children:(0,r.jsx)(L.K,{icon:T.KebabHorizontalIcon,"aria-label":"Attachments options",variant:"invisible",tooltipDirection:"n",className:tw.menuButton,size:V})}),(0,r.jsx)(l.W.Overlay,{width:"small",children:(0,r.jsxs)(u.l,{children:[eo&&(0,r.jsxs)(u.l.Item,{onSelect:es,children:[(0,r.jsx)(u.l.LeadingVisual,{children:Z?(0,r.jsx)(T.EyeClosedIcon,{}):(0,r.jsx)(T.EyeIcon,{})}),Z?"Hide full attachment names":"Show full attachment names"]}),(0,r.jsxs)(u.l.Item,{onSelect:en,children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.TrashIcon,{})}),"Remove attachments"]})]})})]})]}),E[39]=es,E[40]=eo,E[41]=U,E[42]=en,E[43]=Y.length,E[44]=Z,E[45]=V,E[46]=w):w=E[46],E[47]!==x||E[48]!==j||E[49]!==w?(I=(0,r.jsxs)("div",{role:"toolbar","aria-label":"Attachments",className:x,ref:ee,children:[j,w]}),E[47]=x,E[48]=j,E[49]=w,E[50]=I):I=E[50],I});tE.displayName="ChatInputReferences";let tT=(0,m.forwardRef)(function(e,t){let a,n,s,o=(0,i.c)(8),l=e.reference,c=(0,g.pn)(tk),d=`${l.ownerLogin}/${l.name}`,[u,h]=(0,tj.vn)(d),p=(0,m.useRef)(!1),f=u.code===tj.W5.Unindexed||u.docs===tj.W5.Unindexed;return o[0]!==c||o[1]!==f||o[2]!==h?(a=function(){!p.current&&f&&c&&(p.current=!0,h())},n=[c,f,h],o[0]=c,o[1]=f,o[2]=h,o[3]=a,o[4]=n):(a=o[3],n=o[4]),(0,m.useEffect)(a,n),o[5]!==e||o[6]!==t?(s=(0,r.jsx)(tN.BR,{ref:t,...e}),o[5]=e,o[6]=t,o[7]=s):s=o[7],s});try{tT.displayName||(tT.displayName="RepoReferenceToken")}catch{}try{tT.displayName||(tT.displayName="RepoReferenceToken")}catch{}function tA(e){return!e.hasAttribute("aria-hidden")}function tR(e){return!e}function tk(e){return e.model&&!e.model.hasLimitedCapabilities}var tL=a(81829);let tP=()=>{let e,t=(0,i.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("svg",{"aria-label":"Tool",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",fill:"none",viewBox:"0 0 17 16",children:(0,r.jsx)("path",{fill:"currentColor",d:"M6.146 2.344A6 6 0 0 1 11.44.679c.659.117 1.087.598 1.21 1.155a1.68 1.68 0 0 1-.47 1.544L10.19 5.371a.25.25 0 0 0-.069.224l.17.89c.02.101.098.18.198.199l.891.17a.25.25 0 0 0 .224-.069l1.994-1.993a1.68 1.68 0 0 1 1.544-.469 1.48 1.48 0 0 1 1.155 1.211 6 6 0 0 1-1.665 5.295 6 6 0 0 1-5.553 1.614c-.182-.041-.312.015-.37.076l-2.24 2.47a.75.75 0 0 1-1.11-1.007l2.249-2.48c.488-.527 1.199-.658 1.797-.524a4.5 4.5 0 0 0 4.166-1.21 4.5 4.5 0 0 0 1.249-3.972l-.003-.008c-.028-.005-.094 0-.159.065l-1.994 1.993c-.41.41-.996.59-1.565.481l-.89-.17a1.75 1.75 0 0 1-1.392-1.39l-.17-.89a1.75 1.75 0 0 1 .482-1.566l1.993-1.993c.065-.065.07-.132.065-.16l-.008-.003a4.5 4.5 0 0 0-3.972 1.25 4.5 4.5 0 0 0-1.21 4.165c.133.599.004 1.31-.522 1.797l-.007.006-2.474 2.244a.75.75 0 0 1-1.008-1.111l2.47-2.24c.061-.058.118-.187.077-.37a6 6 0 0 1 1.614-5.552"})}),t[0]=e):e=t[0],e};try{tP.displayName||(tP.displayName="MCPIcon")}catch{}var tM=a(97793),tO=a(97665),tD=a(99511),tF=a(40480),tB=a(26382);let t$={container:"McpToolsManager-module__container--PHa2N",header:"McpToolsManager-module__header--PXzkx",headerTitle:"McpToolsManager-module__headerTitle--CiuwN",searchInput:"McpToolsManager-module__searchInput--v2pAX",contentArea:"McpToolsManager-module__contentArea--aqxn4",loadingContainer:"McpToolsManager-module__loadingContainer--btAEV",emptyState:"McpToolsManager-module__emptyState--qpgwB",emptyStateTitle:"McpToolsManager-module__emptyStateTitle--PLCEY",emptyStateDescription:"McpToolsManager-module__emptyStateDescription--x7TOI",footer:"McpToolsManager-module__footer--UZmCo",serverName:"McpToolsManager-module__serverName--au45P",toolItem:"McpToolsManager-module__toolItem--Eo5Ka",toolNameContainer:"McpToolsManager-module__toolNameContainer--VKNAW",toolName:"McpToolsManager-module__toolName--EL2OQ",toolDescription:"McpToolsManager-module__toolDescription--nn86Q"},tz=({anchorRef:e,open:t,onOpenChange:a})=>{let[n,i]=(0,m.useState)(!1),[s,o]=(0,m.useState)(""),[l,c]=(0,m.useState)(null),[u,h]=(0,m.useState)(()=>new Set),{service:p}=(0,F.b)(),g=(0,tO.jE)(),{data:f,isPending:y,isError:x}=(0,tt.I)({enabled:t,queryKey:["copilot-chat-mcps"],queryFn:async()=>p.fetchMCPServers(),placeholderData:e=>e}),v=(0,m.useMemo)(()=>f||[],[f]),C=(0,m.useMemo)(()=>v.filter(e=>e.name.toLowerCase().includes(s.toLowerCase())),[v,s]),_=e=>{h(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eI.T,{open:t,onOpen:()=>a(!0),onClose:()=>a(!1),anchorRef:e,side:"outside-bottom",align:"end",renderAnchor:()=>(0,r.jsx)(r.Fragment,{}),width:"medium",children:(0,r.jsxs)("div",{className:t$.container,children:[(0,r.jsxs)("div",{className:t$.header,children:[(0,r.jsx)("div",{className:t$.headerTitle,children:"MCP tools"}),(0,r.jsx)(tD.A,{placeholder:"Search by provider",value:s,onChange:e=>o(e.target.value),className:t$.searchInput,leadingVisual:T.SearchIcon})]}),(0,r.jsx)("div",{className:t$.contentArea,children:y?(0,r.jsx)("div",{className:t$.loadingContainer,children:(0,r.jsx)(d.A,{})}):x?(0,r.jsxs)(tB.E,{children:[(0,r.jsx)(tB.E.Visual,{children:"\u26A0\uFE0F"}),(0,r.jsx)(tB.E.Heading,{children:"Error loading tools"})]}):0===v.length?(0,r.jsxs)("div",{className:t$.emptyState,children:[(0,r.jsx)(T.ToolsIcon,{size:24}),(0,r.jsx)("div",{className:t$.emptyStateTitle,children:"You don't have any MCP tools configured"}),(0,r.jsx)("div",{className:t$.emptyStateDescription,children:"Add one to connect models to files, APIs, databases, and more."})]}):(0,r.jsx)(tF.G,{"aria-label":"MCP server selection",children:C.map(e=>(0,r.jsxs)(tF.G.Item,{id:e.id,onSelect:()=>(e=>{c(e),_(e)})(e.id),expanded:u.has(e.id),onExpandedChange:()=>_(e.id),current:l===e.id,"aria-selected":l===e.id,children:[(0,r.jsx)("span",{className:t$.serverName,children:e.name}),e.tools&&e.tools.length>0?(0,r.jsx)(tF.G.SubTree,{children:(e=>e.length>0&&"object"==typeof e[0]&&"name"in e[0])(e.tools)?e.tools.map(t=>{let a=`${e.id}-${t.name}`,n=l===a;return(0,r.jsx)(tF.G.Item,{id:a,current:n,"aria-selected":n,onSelect:()=>{!n&&j.W.mcpToolDescriptions?c(a):c(null)},children:j.W.mcpToolDescriptions?(0,r.jsxs)("div",{className:t$.toolItem,children:[(0,r.jsxs)("div",{className:t$.toolNameContainer,children:[n?(0,r.jsx)(T.DashIcon,{size:12}):(0,r.jsx)(T.PlusIcon,{size:12}),(0,r.jsx)("span",{className:t$.toolName,children:t.name})]}),t.description&&n&&(0,r.jsx)("div",{className:t$.toolDescription,children:t.description})]}):t.name},t.name)}):e.tools.map(t=>{let a=`${e.id}-${t}`;return(0,r.jsx)(tF.G.Item,{id:a,onSelect:()=>c(a),current:l===a,"aria-selected":l===a,children:t},t)})}):null]},e.id))})}),(0,r.jsx)("div",{className:t$.footer,children:(0,r.jsx)(k.Q,{variant:"default",leadingVisual:T.PlusIcon,onClick:()=>{i(!0)},block:!0,children:"New tool"})})]})},"mcp-tool-manager"),(0,r.jsx)(tM.O,{isOpen:n,onClose:()=>{i(!1)},onServerAdded:()=>{g.invalidateQueries({queryKey:["copilot-chat-mcps"]})}})]})};try{tz.displayName||(tz.displayName="McpToolsManager")}catch{}let tU=()=>{let e,t=(0,i.c)(2),[a,n]=(0,m.useState)(!1),s=(0,m.useRef)(null);return t[0]!==a?(e=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.K,{ref:s,icon:tP,variant:"invisible","aria-label":"MCP tools",onClick:()=>n(!a)}),(0,r.jsx)(tz,{anchorRef:s,open:a,onOpenChange:n})]}),t[0]=a,t[1]=e):e=t[1],e};try{tU.displayName||(tU.displayName="McpToolMenu")}catch{}var tW=a(12970),tV=a(11196);function tH(){let e,t,a,n=(0,i.c)(8),s=(0,F.b)(),{usePlanningIntent:o,selectedThreadID:l}=(0,g.bP)("usePlanningIntent","selectedThreadID");n[0]!==s||n[1]!==o?(e=()=>s.setUsePlanningIntent(!o),n[0]=s,n[1]=o,n[2]=e):e=n[2];let c=e;if(l){let e;return n[3]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(tV.m,{text:"Planning mode is enabled and cannot be toggled after the conversation has started.",children:(0,r.jsx)(k.Q,{leadingVisual:T.TasklistIcon,inactive:!0,"aria-disabled":!0,"aria-pressed":!0,children:"Plan"})}),n[3]=e):e=n[3],e}return n[4]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(T.TasklistIcon,{}),n[4]=t):t=n[4],n[5]!==c||n[6]!==o?(a=(0,r.jsx)(S,{icon:t,isSelected:o,onClick:c,children:"Plan"}),n[5]=c,n[6]=o,n[7]=a):a=n[7],a}try{tH.displayName||(tH.displayName="PlanningIntentToggle")}catch{}var tq=a(49851),tK=a(66990),tG=a(46642),tQ=a(63422);function tZ(e){let t,a,n,s,o,c,m,h,p,g,f=(0,i.c)(26),{nwo:y,branch:x,selectedAgent:v,onSelect:C}=e,{data:_,isLoading:S}=function(e){let t,a,n,r=(0,i.c)(9),s=(0,F.b)(),o=!!e;return r[0]!==e?(t=["custom-agents",e],r[0]=e,r[1]=t):t=r[1],r[2]!==s||r[3]!==e?(a=async()=>{if(!e)return[];let[t,a]=e.split("/");if(!t||!a)return[];let n=await s.service.fetchCustomAgents(t,a);return n.ok?n.payload:[]},r[2]=s,r[3]=e,r[4]=a):a=r[4],r[5]!==o||r[6]!==t||r[7]!==a?(n={enabled:o,queryKey:t,queryFn:a},r[5]=o,r[6]=t,r[7]=a,r[8]=n):n=r[8],(0,tt.I)(n)}(y);f[0]!==_||f[1]!==v?(t=_?.find(e=>e.name===v),f[0]=_,f[1]=v,f[2]=t):t=f[2];let b=t,j=b?.display_name||b?.name;if(f[3]!==x||f[4]!==y){let e=new URLSearchParams({filename:".github/agents/my-agent.md",value:`--- name: description: --- # My Agent Describe what your agent does here...`});a=y,n=x,s=e.toString(),f[3]=x,f[4]=y,f[5]=a,f[6]=n,f[7]=s}else a=f[5],n=f[6],s=f[7];let w=`/${a}/new/${n}?${s}`,N=j?`Custom agent: ${j}`:"Select a custom agent",I=!y||!x,E=!!v;return f[8]!==N||f[9]!==I||f[10]!==E?(o=(0,r.jsx)(l.W.Anchor,{children:(0,r.jsx)(tQ.L,{icon:T.CopilotIcon,selectedIcon:tq.c9,"aria-label":N,selected:E,disabled:I})}),f[8]=N,f[9]=I,f[10]=E,f[11]=o):o=f[11],f[12]!==_||f[13]!==S||f[14]!==C||f[15]!==v?(c=S?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(u.l.Item,{children:[(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(d.A,{size:"small"})}),"Loading"]}),(0,r.jsx)(u.l.Divider,{})]}):_&&_.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(u.l.Group,{selectionVariant:"single",children:[(0,r.jsx)(u.l.Item,{selected:null===v,onSelect:()=>C(void 0),children:"None"}),_.map(e=>(0,r.jsx)(u.l.Item,{selected:v===e.name,onSelect:()=>C(e.name),children:e.display_name||e.name},e.name))]}),(0,r.jsx)(u.l.Divider,{})]}),f[12]=_,f[13]=S,f[14]=C,f[15]=v,f[16]=c):c=f[16],f[17]===Symbol.for("react.memo_cache_sentinel")?(m=(0,r.jsx)(u.l.LeadingVisual,{children:(0,r.jsx)(T.PlusIcon,{})}),f[17]=m):m=f[17],f[18]!==w?(h=(0,r.jsx)(u.l.Group,{selectionVariant:!1,children:(0,r.jsxs)(u.l.LinkItem,{href:w,target:"_blank",children:[m,"Create an agent"]})}),f[18]=w,f[19]=h):h=f[19],f[20]!==c||f[21]!==h?(p=(0,r.jsx)(l.W.Overlay,{width:"auto",children:(0,r.jsxs)(u.l,{children:[c,h]})}),f[20]=c,f[21]=h,f[22]=p):p=f[22],f[23]!==p||f[24]!==o?(g=(0,r.jsxs)(l.W,{children:[o,p]}),f[23]=p,f[24]=o,f[25]=g):g=f[25],g}try{tZ.displayName||(tZ.displayName="CustomAgentSelector")}catch{}let tJ={container:"RepoBranchAgentSelector-module__container--gHrlH"},tY=e=>{let t,a,n,s,o,l,c,d=(0,i.c)(28),{selectedRepo:u,selectedBranch:m,selectedCustomAgent:h,onRepoSelect:p,onBranchSelect:g,onCustomAgentSelect:f,agentSelectionEnabled:y}=e,x=void 0===y||y;d[0]!==g||d[1]!==p||d[2]!==u?(t=e=>{if(!u){let t=e.find(t0);t&&(p(t),g(t.defaultBranch))}},d[0]=g,d[1]=p,d[2]=u,d[3]=t):t=d[3];let v=t;d[4]!==g||d[5]!==p?(a=e=>{e&&(p(e),g(e.defaultBranch))},d[4]=g,d[5]=p,d[6]=a):a=d[6];let C=`Repository: ${u?.nameWithOwner||"Select repository"}`;return d[7]!==C?(n={"aria-label":C},d[7]=C,d[8]=n):n=d[8],d[9]!==v||d[10]!==u||d[11]!==a||d[12]!==n?(s=(0,r.jsx)(tG.P,{repositoryLoader:tX,selectionVariant:"single",selectAllOption:!1,onSelect:a,currentSelection:u,width:"medium",additionalButtonProps:n,onLoad:v}),d[9]=v,d[10]=u,d[11]=a,d[12]=n,d[13]=s):s=d[13],d[14]!==g||d[15]!==m||d[16]!==u?(o=(0,r.jsx)(r.Fragment,{children:u?(0,r.jsx)(tK.PI,{cacheKey:"repo-branch-agent-selector",canCreate:!1,currentCommitish:m??u.defaultBranch,defaultBranch:u.defaultBranch,owner:u.owner,repo:u.nameOnly,types:["branch"],selectedRefType:"branch",closeOnSelect:!0,hideShowAll:!0,actionListHeadingText:"Select a branch",onSelectItem:g,renderAnchor:e=>(0,r.jsx)(tQ.L,{...e,icon:T.GitBranchIcon,selectedIcon:tq.gh,selected:m!==u.defaultBranch,"aria-label":`Branch: ${m||"Select branch"}`,"aria-labelledby":void 0})}):(0,r.jsx)(L.K,{icon:T.GitBranchIcon,"aria-label":"Loading branches\u2026",disabled:!0})}),d[14]=g,d[15]=m,d[16]=u,d[17]=o):o=d[17],d[18]!==x||d[19]!==f||d[20]!==m||d[21]!==h||d[22]!==u?(l=x&&(u?(0,r.jsx)(tZ,{nwo:u.nameWithOwner,branch:m,selectedAgent:h,onSelect:f}):(0,r.jsx)(L.K,{icon:T.CopilotIcon,"aria-label":"Loading agents\u2026",disabled:!0})),d[18]=x,d[19]=f,d[20]=m,d[21]=h,d[22]=u,d[23]=l):l=d[23],d[24]!==s||d[25]!==o||d[26]!==l?(c=(0,r.jsxs)("div",{className:tJ.container,children:[s,o,l]}),d[24]=s,d[25]=o,d[26]=l,d[27]=c):c=d[27],c};async function tX(e="",t){let a=new URL("/copilot/agent-sessions/repositories",window.location.origin);e.trim()&&a.searchParams.set("q",e.trim()),t&&a.searchParams.set("defaultOwner",t);let n=await (0,M.lS)(a.href);if(n.ok){let{repositories:e}=await n.json();return e.map(e=>({id:e.id,nameWithOwner:e.nameWithOwner,enabled:!0,name:e.nameWithOwner,owner:e.owner,nameOnly:e.name,defaultBranch:e.defaultBranch,visibility:e.visibility}))}return[]}try{tY.displayName||(tY.displayName="RepoBranchAgentPicker")}catch{}function t0(e){return e.enabled}let t1=["github:cancel","copilot-chat:send-message","copilot-chat:edit-last-message"],t2=e=>{let t,a,n,l,c,d,u,h,p,f,y,_,S,b,w,T,R,k,L,Z,el,ec,ed,eu,em,eh,ep,eg,ef,ey,ex,ev,eC,e_,eS,eb,ej,ew,eN,eI,eE,eT,eA=(0,i.c)(197),eR=(0,g.bP)("defaultRecipient","isWaitingOnAttachment","attachmentProcessingType","isWaitingOnCopilot","messages","mode","model","selectedThreadID","skillOptions","slashCommandLoading","thirdPartyMcpAllowed"),{model:ek}=eR,eL=(0,eo.tD)(),eP=(0,F.b)();eA[0]!==eP?(t=eP.maxMessagesReached(),eA[0]=eP,eA[1]=t):t=eA[1];let eM=t,[eO,eD]=(0,m.useState)(null),eF="loading"===eR.slashCommandLoading.state,{safeSetTimeout:eB}=(0,A.A)(),{onSelectReference:e$,containerRef:ez,shouldClearTextOnSubmit:eU,slashCommandsEnabled:eW}=e,eV=void 0===eU||eU,eq=void 0!==eW&&eW,eK=(0,m.useRef)(null),eG=(0,m.useRef)(""),eQ=(0,m.useRef)(!1),{activeCopilotSpaceId:eZ}=(0,x.C)();eA[2]!==e.activeModeName||eA[3]!==e.modes?(a=e.modes.find(t=>t.name===e.activeModeName)||e.modes[0],eA[2]=e.activeModeName,eA[3]=e.modes,eA[4]=a):a=eA[4];let eJ=a;eA[5]!==eP||eA[6]!==e.initialReference?(n=()=>{e.initialReference&&eP.addReference(e.initialReference,"page-file-reference")},l=[e.initialReference,eP],eA[5]=eP,eA[6]=e.initialReference,eA[7]=n,eA[8]=l):(n=eA[7],l=eA[8]),(0,m.useEffect)(n,l),eA[9]!==eO||eA[10]!==eR.mode?(c=e=>{eK.current=null,eG.current="",eQ.current=!1,eO&&(eD(null),void 0!==e&&e&&(0,s.BI)("dotcom_chat.activate",{target:"CONVERT_TO_FILE_DISMISS",mode:eR.mode}))},eA[9]=eO,eA[10]=eR.mode,eA[11]=c):c=eA[11];let eY=c;eA[12]!==eq?(d={enabled:eq},eA[12]=eq,eA[13]=d):d=eA[13];let{availableCommands:eX,availableCommandKeys:e0}=(0,H.j)(d),e1=eR.isWaitingOnCopilot||eR.isWaitingOnAttachment||eF;eA[14]!==eX||eA[15]!==eY||eA[16]!==e.disableSavedUserMessage||eA[17]!==e.isInPortal||eA[18]!==e.onChatCommandChange||eA[19]!==e.onSubmit||eA[20]!==e.textAreaRef||eA[21]!==eV||eA[22]!==e1?(u={isLoading:e1,onSubmit:e.onSubmit,textAreaRef:e.textAreaRef,clearPastedFile:eY,onChatCommandChange:e.onChatCommandChange,disableSavedUserMessage:e.disableSavedUserMessage,isInPortal:e.isInPortal,shouldClearTextOnSubmit:eV,availableCommands:eX},eA[14]=eX,eA[15]=eY,eA[16]=e.disableSavedUserMessage,eA[17]=e.isInPortal,eA[18]=e.onChatCommandChange,eA[19]=e.onSubmit,eA[20]=e.textAreaRef,eA[21]=eV,eA[22]=e1,eA[23]=u):u=eA[23];let{typingHasStarted:e2,textAreaRef:e5,textareaPreviewRef:e3,textAreaPreviewContainerRef:e4,text:e7,setText:e6,isAgentTaskSubmitInProgress:e8,handleSubmit:e9,handleSubmitToNewThread:te,handleScroll:tt,handleChange:ta,handleStop:tn,handleFocus:tr,command:ti,selectedRepo:ts,setSelectedRepo:to,selectedBranch:tl,setSelectedBranch:tc,selectedCustomAgent:td,setSelectedCustomAgent:tu}=function(e){let t=(0,g.Pk)(),a=(0,F.b)(),n=(0,K.Z)(),{selectedThreadID:r,mode:i,autoSubmit:l,model:c}=t,{clearPastedFile:d,isLoading:u,onSubmit:h,onChatCommandChange:p,disableSavedUserMessage:f,isInPortal:y,shouldClearTextOnSubmit:x=!0,availableCommands:v=[]}=e,C=Q.Jt.getSavedMessage(r),_=Q.Jt.getSavedUserMessageOnError(r),{pathname:S}=(0,o.zy)(),[b,w]=(0,o.ok)(),[N,I]=(0,m.useState)(()=>{let e=et(t.mode,S,b);return f?e??"":e??_??C??""}),[E,T]=(0,m.useState)(!1),[R,k]=(0,m.useState)(null),[L,P]=(0,m.useState)(!1),M=(0,m.useRef)(null),O=e.textAreaRef||M,D=(0,m.useRef)(null),B=(0,m.useRef)(null),$=(0,m.useRef)(0),z=(0,m.useRef)(null),U=(0,m.useRef)(()=>{}),W=(0,m.useRef)(!1),V=(0,Y.GF)(t.availableModels),H=(0,m.useRef)(r),{safeSetTimeout:Z}=(0,A.A)(),ea=(0,m.useRef)(0),[en,er]=(0,ee.T)(),[ei,es]=(0,m.useState)(()=>{if(en){let e=`${en.ownerLogin}/${en.name}`;return{id:en.id,nameWithOwner:e,enabled:!0,name:e,owner:en.ownerLogin,nameOnly:en.name,defaultBranch:en.defaultBranch||"main",visibility:en.visibility}}}),eo=(0,m.useCallback)(e=>{es(e),(async()=>{if(e){let t=await a.service.fetchRepo(e.id);t.ok&&t.payload&&er(t.payload)}})()},[a.service,er]),[el,ec]=(0,m.useState)(()=>ei?.defaultBranch),[ed,eu]=(0,m.useState)(void 0),em=(0,m.useCallback)(async()=>{t.renderAttachKnowledgeBaseHerePopover&&await a.fetchKnowledgeBases()},[a,t.renderAttachKnowledgeBaseHerePopover]);(0,m.useEffect)(()=>{em()},[em]),(0,m.useEffect)(()=>{if(!j.W.stableConversationView)return void Q.Jt.setSavedMessage(r,N);r===H.current?Q.Jt.setSavedMessage(r,N):(I(Q.Jt.getSavedMessage(r)||""),H.current=r)},[r,N]),(0,q.N)(()=>{let e=0;!function t(){if(!O.current||!B.current||!D.current)return;if(e++,(y||"assistive"===i)&&0===O.current.scrollHeight&&e<10)return void Z(t,1);if(0===N.length&&56===ea.current)return;O.current.style.height="0";let a=Math.max(O.current.scrollHeight,56),n=Math.min(a,300);D.current.style.height=`${a}px`,O.current.style.height=`${a}px`,B.current.style.height=`${n}px`,ea.current=n}()},[i,Z,N,O,D,y]);let eh=(0,m.useCallback)(()=>{O?.current&&D?.current&&B?.current&&(D.current.scrollTop=O.current.scrollTop,D.current.scrollLeft=O.current.scrollLeft)},[O]),ep=(0,m.useMemo)(()=>t.currentReferences.filter(e=>!("isClientOnly"in e)||!e.isClientOnly),[t.currentReferences]),eg=(0,m.useCallback)(async e=>{if(P(!1),Q.Jt.clearSavedUserMessage(r),Q.Jt.clearSavedUserMessageOnError(r),t.defaultRecipient&&!N.includes(`@${t.defaultRecipient}`)&&a.clearDefaultRecipient(),e?.preventDefault(),await J(N,t,a,n,v,"task"===R?{selectedRepo:ei,selectedBranch:el,selectedCustomAgent:ed}:{})){if((0,s.BI)("dotcom_chat.activate",{target:"SLASH_COMMAND_EXECUTED",mode:t.mode,command:N}),"/new"===N.trim()&&Q.Jt.setSavedMessageFast(r,null),x)I("");else{let e=N.substring(N.indexOf(" ")+1).trim();T(!0),I(`Creating ${e}...`)}return}if(!u){let e=N;if(!e){let[t,n]=a.tryInferMessage(ep);if(!t||!n)return;e=n}try{I("");let t=[];if("task"===R&&ei){let a={type:"task-request",description:e,repoOwner:ei.owner,repoName:ei.nameOnly,ref:el||ei.defaultBranch,customAgent:ed};t.push(a)}await h?.(e,t.length>0?t:void 0)}catch(t){if(T(!1),t instanceof X.q)return void I(e);throw t}}},[r,t,N,a,n,v,R,ei,el,ed,u,x,ep,h]),ef=(0,m.useCallback)(()=>a.sendMessageToNewThread(r,N,ep,t.context,V),[a,r,t.context,ep,N,V]);(0,m.useEffect)(()=>{(async()=>{let e=et(i,S,b),t=new URLSearchParams(b),a=t.get("model"),n=!a||a===c.id;e&&n&&!W.current&&(t.delete("prompt"),t.delete("model"),(0,s.BI)("dotcom_chat.activate",{target:"COPILOT_PROMPT_LOADED_FROM_URL",mode:"immersive"}),w(t,{replace:!0}),l&&(W.current=!0,await Promise.resolve(),await eg()))})()},[S,b,w,i,l,c,eg]);let ey=(0,m.useCallback)(e=>{P(!0),O?.current&&(I(e.target.value),d?.(),$.current=0,eh())},[eh,d,O]),ex=(0,m.useCallback)(async()=>{await a.stopStreaming(),null!=r&&(a.startThreadReload(),await new Promise(e=>{z.current=setTimeout(()=>e(r),6e3)}),U.current=await a.fetchMessages(r,!0,!0))},[a,r]);return(0,m.useEffect)(()=>{U.current&&(U.current(),U.current=()=>{})},[t.messages]),(0,m.useEffect)(()=>()=>{z.current&&(clearTimeout(z.current),z.current=null),a.cancelThreadReload(),U.current=()=>{}},[a]),(0,m.useEffect)(()=>{if(0===v.length&&!j.W.taskWithinChatThread)return;let e=(0,G.V)(N,v.map(e=>e.key));R!==e&&(k(e),p?.(e))},[N,R,p,v]),{typingHasStarted:L,textAreaRef:O,textareaPreviewRef:D,textAreaPreviewContainerRef:B,text:N,setText:I,isAgentTaskSubmitInProgress:E,command:R,setCommand:k,handleSubmit:eg,handleSubmitToNewThread:ef,handleScroll:eh,handleChange:ey,handleStop:ex,handleFocus:e=>{e.currentTarget.selectionStart>0||e.currentTarget.setSelectionRange(e.currentTarget.value.length,e.currentTarget.value.length)},selectedRepo:ei,setSelectedRepo:eo,selectedBranch:el,setSelectedBranch:ec,selectedCustomAgent:ed,setSelectedCustomAgent:eu}}(u);eA[24]!==e6?(h=()=>({setText:e6}),p=[e6],eA[24]=e6,eA[25]=h,eA[26]=p):(h=eA[25],p=eA[26]),(0,m.useImperativeHandle)(e.chatInputRef,h,p),eA[27]!==ta||eA[28]!==e5?(f={inputRef:e5,fallbackEventHandler:ta},eA[27]=ta,eA[28]=e5,eA[29]=f):f=eA[29];let tm=(0,E.H)(f);eA[30]!==tm||eA[31]!==e.figmaAuthUrl||eA[32]!==e5?(y={figmaAuthUrl:e.figmaAuthUrl,textAreaRef:e5,emitChange:tm},eA[30]=tm,eA[31]=e.figmaAuthUrl,eA[32]=e5,eA[33]=y):y=eA[33];let{replaceUrlWithReferenceMention:tp}=function(e){let t,a,n,r,s,o,l,c,d,u,m,h,p=(0,i.c)(35),{figmaAuthUrl:f,textAreaRef:y,emitChange:x}=e,C=(0,F.b)(),{currentReferences:_}=(0,g.Pk)();p[0]!==x||p[1]!==y?(t=(e,t,a)=>{if(!y.current||e===t)return;let n=a?.[0]??0,r=y.current.value.slice(n,a?.[1]),i=r.indexOf(e);for(;i>-1;){let a=i+e.length;x(t,[i+n,a+n]),i=(r=r.replace(e,t)).indexOf(e)}},p[0]=x,p[1]=y,p[2]=t):t=p[2];let S=t;p[3]!==C?(a=e=>{let{itemUrl:t}=e,a=(0,v.Vc)(t);return C.addReference(a,"url-attacher"),C.dispatch({type:"WAITING_ON_ATTACHMENT",loading:!0,attachmentType:"url-reference"}),a},p[3]=C,p[4]=a):a=p[4],p[5]!==S||p[6]!==C?(n=(e,t,a)=>{let{parsedReferenceMention:n}=t;C.replaceReference(a,e);let r=B.Q.for(e);if(!r)return;let i=B.Q.stringify(n),s=B.Q.stringify(r);i!==s&&S(i,s)},r=(e,t,a)=>{let{itemUrl:n,parsedReferenceMention:r}=t;C.removeReference(a),S(B.Q.stringify(r),n)},p[5]=S,p[6]=C,p[7]=n,p[8]=r):(n=p[7],r=p[8]),p[9]!==C?(s=()=>{C.dispatch({type:"WAITING_ON_ATTACHMENT",loading:!1})},p[9]=C,p[10]=s):s=p[10],p[11]!==a||p[12]!==n||p[13]!==r||p[14]!==s?(o={mutationFn:V,onMutate:a,onSuccess:n,onError:r,onSettled:s},p[11]=a,p[12]=n,p[13]=r,p[14]=s,p[15]=o):o=p[15];let b=(0,P.n)(o);p[16]!==C?(l=e=>{let t=(0,v.Vc)(e);return C.addReference(t,"figma-attacher"),C.dispatch({type:"WAITING_ON_ATTACHMENT",loading:!0,attachmentType:"url-reference"}),t},c=(e,t,a)=>{C.replaceReference(a,e)},p[16]=C,p[17]=l,p[18]=c):(l=p[17],c=p[18]),p[19]!==f||p[20]!==C?(d=(e,t,a)=>{a&&f&&e instanceof U?C.replaceReference(a,{type:"figma",title:"Sign in to Figma",id:`forbidden-${t}`,url:f,thumbnailUrl:"",fullImageUrl:"",authenticationRequired:!0}):C.removeReference(a)},p[19]=f,p[20]=C,p[21]=d):d=p[21],p[22]!==C?(u=()=>{C.dispatch({type:"WAITING_ON_ATTACHMENT",loading:!1})},p[22]=C,p[23]=u):u=p[23],p[24]!==u||p[25]!==l||p[26]!==c||p[27]!==d?(m={mutationFn:W,onMutate:l,onSuccess:c,onError:d,onSettled:u},p[24]=u,p[25]=l,p[26]=c,p[27]=d,p[28]=m):m=p[28];let j=(0,P.n)(m);return p[29]!==_||p[30]!==j||p[31]!==S||p[32]!==b||p[33]!==y?(h={replaceUrlWithReferenceMention:e=>{let t=y.current?.value.slice(...e)??"";if(/\s/.test(t))return t;let a=B.Q.fromUrl(t);a&&(_.every(e=>!B.Q.refersTo(a,e))&&b.mutate({itemUrl:t,parsedReferenceMention:a}),S(t,B.Q.stringify(a),e));let n=z.exec(t);return n&&(j.mutate(t),S(t,n[1],e)),t}},p[29]=_,p[30]=j,p[31]=S,p[32]=b,p[33]=y,p[34]=h):h=p[34],h}(y),{isLoading:tf,addReferenceForMention:ty,addReferencesForMentions:tv}=function(){let e=(0,F.b)(),{currentReferences:t,mode:a}=(0,g.Pk)(),n=(0,P.n)({mutationFn:async e=>{let t="repository"===e.type?[e.repo]:[e.repo,(e=>{switch(e){case"issue":return"issue";case"pull-request":return"pull_request";case"discussion":return"discussion";case"thread-scoped-file":case"file":return"file"}})(e.type),e.id??""],n=await (0,M.lS)(`/copilot/chat/reference/${t.join("/")}`);if(!n.ok)throw Error(`Failed to fetch reference data (${n.status}: ${n.statusText})`);return(0,s.BI)("dotcom_chat.activate",{target:"REFERENCE_LINK_PASTE",mode:a,linkType:e.type}),await n.json()},onSuccess:t=>e.addReference(t,"chatInput")}),r=e=>{t.every(t=>!B.Q.refersTo(e,t))&&n.mutate(e)};return{isLoading:n.isPending,addReferenceForMention:r,addReferencesForMentions:e=>{let a=(0,O.l)().use($.U,{references:t,agents:[],commands:[]}).parse(e),n=0;(0,D.YR)(a,e=>{"reference-mention"===e.type&&void 0===e.data.mentionedReferenceId&&n<20&&(n++,r(e.data.referenceMention))})}}}(),tC=(0,es.FQ)(),t_=eZ&&tC,tS=!!(eZ&&tC),tb=eF||tf||eR.isWaitingOnAttachment||!!e.submitDisabled||"task"===ti&&!ts&&!tl||e8,tj=0===e7.length;eA[34]!==tn||eA[35]!==eR.mode?(_=()=>{(0,s.BI)("dotcom_chat.activate",{target:"CHAT_MESSAGE_STOP",mode:eR.mode}),tn()},eA[34]=tn,eA[35]=eR.mode,eA[36]=_):_=eA[36];let tw=_;eA[37]!==eZ||eA[38]!==eY||eA[39]!==e9||eA[40]!==tC||eA[41]!==eP||eA[42]!==eO||eA[43]!==tS||eA[44]!==eR.mode||eA[45]!==eR.selectedThreadID||eA[46]!==tb?(S=async()=>{if(tb)return;let e=eZ?`${eZ.owner}/${eZ.id}`:"";(0,s.BI)("dotcom_chat.activate",{target:"CHAT_MESSAGE_SUBMIT",mode:eR.mode,selectedThreadId:eR.selectedThreadID,copilotSpace:e,fromSpaceUI:tC}),tS&&await eP.selectPendingThread(eZ),eO&&eY(!1),e9()},eA[37]=eZ,eA[38]=eY,eA[39]=e9,eA[40]=tC,eA[41]=eP,eA[42]=eO,eA[43]=tS,eA[44]=eR.mode,eA[45]=eR.selectedThreadID,eA[46]=tb,eA[47]=S):S=eA[47];let tN=S;eA[48]!==eZ||eA[49]!==te||eA[50]!==eP||eA[51]!==tS||eA[52]!==tb?(b=async()=>{tb||(tS&&await eP.selectPendingThread(eZ),te())},eA[48]=eZ,eA[49]=te,eA[50]=eP,eA[51]=tS,eA[52]=tb,eA[53]=b):b=eA[53];let tI=b;eA[54]!==eP||eA[55]!==eR.messages?(w=()=>{let e=eR.messages.findLast(t7)?.id;e&&eP.startEditingMessage(e)},eA[54]=eP,eA[55]=eR.messages,eA[56]=w):w=eA[56];let tT=w;e:{if(eR.isWaitingOnCopilot){T="Copilot is responding\u2026";break e}if(eR.defaultRecipient){T=void 0;break e}if(eM){T="Message limit reached. To continue chatting with Copilot, start a new conversation.";break e}T=eJ.placeholder??"Ask anything"}let tA=T;eR.defaultRecipient&&""===e7&&!e2&&e6(`@${eR.defaultRecipient} `);let tR=(0,m.useRef)(null),[tk,tP]=(0,m.useState)(null),[tM,tO]=(0,m.useState)(null);eA[57]!==eR.mode?(R=()=>{(0,s.BI)("dotcom_chat.activate",{target:"ATTACHMENT_MENU",mode:eR.mode}),tP(t6)},eA[57]=eR.mode,eA[58]=R):R=eA[58];let tD=R;eA[59]!==eP||eA[60]!==eR.mode||eA[61]!==eR.skillOptions?.deepCodeSearch?(k=()=>{(0,s.BI)("dotcom_chat.activate",{target:"DEEP_CODESEARCH",mode:eR.mode}),eP.dispatch({type:"SET_DEEP_CODESEARCH",deepCodeSearch:!eR.skillOptions?.deepCodeSearch})},eA[59]=eP,eA[60]=eR.mode,eA[61]=eR.skillOptions?.deepCodeSearch,eA[62]=k):k=eA[62],eR.skillOptions?.deepCodeSearch;let tF=k,tB="immersive"===eR.mode&&!!ek.capabilities?.supports?.vision;eA[63]!==eZ||eA[64]!==eL||eA[65]!==eP||eA[66]!==ek||eA[67]!==tS||eA[68]!==e.existingFileNames||eA[69]!==tB?(L=async(t,a,n,r)=>{let i=new en.s(eL(),eP),s=new ei.E(eP,e.existingFileNames),o=[];[...t].some(t8)&&!ek.capabilities?.supports?.vision&&(eP.addAmbientError(`The ${ek.displayName} model doesn't support answering questions about images. Select a different model and try again.`),(0,er.d)("vision_not_supported_for_model",{modelId:ek.id,uploadType:a}));let[l,c]=en.s.getAllowedFiles([...t],ek);if(tB){let e=await i.addImageAttachments(l,a,eZ,tS);e&&o.push(...e)}let d=[];for(let e of c)if(await ei.E.isAttachable(e)){let t=await s.addAttachment(e,n,r);t&&o.push(t)}else d.push(e.type);return tB&&d.length>0&&(0,er.d)("included_unsupported_file",{fileTypes:d.join(","),uploadType:a}),o},eA[63]=eZ,eA[64]=eL,eA[65]=eP,eA[66]=ek,eA[67]=tS,eA[68]=e.existingFileNames,eA[69]=tB,eA[70]=L):L=eA[70];let t$=L;eA[71]!==eY||eA[72]!==t$||eA[73]!==eO||eA[74]!==e6||eA[75]!==eR.mode||eA[76]!==e7?(Z=async()=>{if(!eO)return;let e=[eO],t=await t$(e,"paste",eK.current||void 0,eG.current);if(t.length>0&&t[0]?.type==="thread-scoped-file"){let e=await eO.text();e6(e7.replaceAll(e,`@${t[0].name}`)),eY(!1),(0,s.BI)("dotcom_chat.activate",{target:"CONVERT_TO_FILE_CONVERT",mode:eR.mode})}},eA[71]=eY,eA[72]=t$,eA[73]=eO,eA[74]=e6,eA[75]=eR.mode,eA[76]=e7,eA[77]=Z):Z=eA[77];let tz=Z;eA[78]!==eY?(el=()=>{eY(!0)},eA[78]=eY,eA[79]=el):el=eA[79];let tU=el;eA[80]!==eO||eA[81]!==eR.isWaitingOnAttachment||eA[82]!==eR.mode?(ec=()=>{!eO||eR.isWaitingOnAttachment||eQ.current||(eQ.current=!0,(0,s.BI)("dotcom_chat.activate",{target:"CONVERT_TO_FILE_TRIGGER",mode:eR.mode}))},ed=[eO,eR.isWaitingOnAttachment,eR.mode],eA[80]=eO,eA[81]=eR.isWaitingOnAttachment,eA[82]=eR.mode,eA[83]=ec,eA[84]=ed):(ec=eA[83],ed=eA[84]),(0,m.useEffect)(ec,ed);let tW=(eJ.supportsReferenceAttachments??!0)&&"task"!==ti;eA[85]!==tv||eA[86]!==t$||eA[87]!==eP||eA[88]!==e.existingFileNames||eA[89]!==tp||eA[90]!==eB||eA[91]!==tW||eA[92]!==e5?(eu=t=>{let a=t.clipboardData;if(a?.items){let n=[];for(let t=0;t1e3&&t.length<=ei.E.getAttachmentSizeLimit())eB(()=>{eQ.current=!1;let a=new File([t],"",{type:ei.x}),n=new ei.E(eP,e.existingFileNames);eD(a),eK.current=n.generateFileName(t,a.type).then(e=>eG.current=e)},1);else if(tW){tv(t);let e=e5.current?.selectionStart??0;setTimeout(()=>tp([e,e+t.length]))}return}}}n.length>0&&(t.preventDefault(),t$(n,"paste"))}},eA[85]=tv,eA[86]=t$,eA[87]=eP,eA[88]=e.existingFileNames,eA[89]=tp,eA[90]=eB,eA[91]=tW,eA[92]=e5,eA[93]=eu):eu=eA[93];let tV=eu;eA[94]!==t$?(em=e=>{t$(e,"drag")},eA[94]=t$,eA[95]=em):em=eA[95];let tH=em,tq=e.isStreaming||eR.isWaitingOnCopilot,tK=!!eJ.supportsAttachments&&"task"!==ti,tG=tq?tw:void 0,tQ=tj?tT:void 0;eA[96]!==tD||eA[97]!==tN||eA[98]!==tI||eA[99]!==tF||eA[100]!==tG||eA[101]!==tQ?(eh={"github:cancel":tG,"copilot-chat:send-message":tN,"copilot-chat:send-message-new-conversation":tI,"copilot-chat:add-attachment":tD,"copilot-chat:edit-last-message":tQ,"copilot-chat:deep-codesearch":tF},eA[96]=tD,eA[97]=tN,eA[98]=tI,eA[99]=tF,eA[100]=tG,eA[101]=tQ,eA[102]=eh):eh=eA[102];let tZ=eh,tJ="small"===e.size;eA[103]!==e.className||eA[104]!==e.disabled||eA[105]!==tJ?(ep=(0,C.$)(tg.container,{[tg.containerSmall]:tJ,[tg.containerDisabled]:e.disabled},e.className),eA[103]=e.className,eA[104]=e.disabled,eA[105]=tJ,eA[106]=ep):ep=eA[106],eA[107]===Symbol.for("react.memo_cache_sentinel")?(eg=(0,N.G)("copilot-chat-input-form"),eA[107]=eg):eg=eA[107],eA[108]!==tz||eA[109]!==tU||eA[110]!==tf||eA[111]!==e$||eA[112]!==eO||eA[113]!==e.getReferenceVersion||eA[114]!==e.initialReference||eA[115]!==e.onRemoveReference||eA[116]!==e.size||eA[117]!==eR.isWaitingOnAttachment||eA[118]!==tW?(ef=tW&&(0,r.jsx)(tE,{className:tg.attachments,returnFocusRef:tR,tokenSize:"small"===e.size?"small":"medium",isLoading:tf,onSelectReference:e$,onRemoveReference:e.onRemoveReference,getReferenceVersion:e.getReferenceVersion,showConvertToFileText:!!eO&&!eR.isWaitingOnAttachment,onConvertToFile:tz,onConvertToFileDismiss:tU,hideAttachmentsMenu:!!e.initialReference}),eA[108]=tz,eA[109]=tU,eA[110]=tf,eA[111]=e$,eA[112]=eO,eA[113]=e.getReferenceVersion,eA[114]=e.initialReference,eA[115]=e.onRemoveReference,eA[116]=e.size,eA[117]=eR.isWaitingOnAttachment,eA[118]=tW,eA[119]=ef):ef=eA[119],eA[120]!==e.isNewConversation?(ey=(0,C.$)(tg.inputContainer,{[tg.inputContainerNewConversation]:e.isNewConversation}),eA[120]=e.isNewConversation,eA[121]=ey):ey=eA[121];let tX=!eJ.supportsAutocompletion,t0=!e.disableAutoFocus,t2=eJ.textAreaAriaLabel||tA,t3=eM||e.disabled;eA[122]===Symbol.for("react.memo_cache_sentinel")?(ex=(0,N.G)("copilot-chat-input-textarea"),eA[122]=ex):ex=eA[122],eA[123]!==ta||eA[124]!==tr||eA[125]!==tV||eA[126]!==tt||eA[127]!==tA||eA[128]!==t0||eA[129]!==t2||eA[130]!==t3||eA[131]!==e7||eA[132]!==e5?(ev=(0,r.jsx)("textarea",{autoFocus:t0,id:ea.wg,className:tg.input,autoComplete:"off",autoCorrect:"off",spellCheck:"false","aria-label":t2,"aria-multiline":"true",onPaste:tV,ref:e5,onScroll:tt,onChange:ta,onFocus:tr,placeholder:tA,value:e7,"data-react-autofocus":!0,disabled:t3,...ex}),eA[123]=ta,eA[124]=tr,eA[125]=tV,eA[126]=tt,eA[127]=tA,eA[128]=t0,eA[129]=t2,eA[130]=t3,eA[131]=e7,eA[132]=e5,eA[133]=ev):ev=eA[133],eA[134]!==ty||eA[135]!==eX||eA[136]!==tX||eA[137]!==ev?(eC=(0,r.jsx)(th,{onSelectReference:ty,onShowAgentsDialog:tP,hideAutocomplete:tX,availableCommands:eX,children:ev}),eA[134]=ty,eA[135]=eX,eA[136]=tX,eA[137]=ev,eA[138]=eC):eC=eA[138],eA[139]!==e0||eA[140]!==e7||eA[141]!==e3?(e_=(0,r.jsx)(tx,{text:e7,ref:e3,availableCommandKeys:e0}),eA[139]=e0,eA[140]=e7,eA[141]=e3,eA[142]=e_):e_=eA[142],eA[143]!==ey||eA[144]!==eC||eA[145]!==e_||eA[146]!==e4?(eS=(0,r.jsxs)(I.tL.LimitKeybindingScope,{commandIds:t1,className:ey,ref:e4,children:[eC,e_]}),eA[143]=ey,eA[144]=eC,eA[145]=e_,eA[146]=e4,eA[147]=eS):eS=eA[147];let t4=eR.skillOptions?.deepCodeSearch;return eA[148]!==ti||eA[149]!==e.extraToolbar||eA[150]!==tl||eA[151]!==td||eA[152]!==ts||eA[153]!==tc||eA[154]!==tu||eA[155]!==to?(eb="task"===ti?(0,r.jsx)(tY,{selectedRepo:ts,selectedBranch:tl,selectedCustomAgent:td,onRepoSelect:to,onBranchSelect:tc,onCustomAgentSelect:tu,agentSelectionEnabled:j.W.sweAgentUseSubagents}):e.extraToolbar,eA[148]=ti,eA[149]=e.extraToolbar,eA[150]=tl,eA[151]=td,eA[152]=ts,eA[153]=tc,eA[154]=tu,eA[155]=to,eA[156]=eb):eb=eA[156],eA[157]!==tD||eA[158]!==ti||eA[159]!==eJ||eA[160]!==e8||eA[161]!==t_||eA[162]!==e.disabled||eA[163]!==e.modes||eA[164]!==e.onNewThreadSelected||eA[165]!==e.showPlanningToggle||eA[166]!==eR.thirdPartyMcpAllowed||eA[167]!==tq||eA[168]!==tb||eA[169]!==tK||eA[170]!==t4||eA[171]!==eb?(ej=(0,r.jsx)(t5,{addAttachment:tD,currentMode:eJ,attachmentButtonRef:tR,deepCodeSearch:t4,modes:e.modes,stoppable:tq,submitDisabled:tb,onNewThreadSelected:e.onNewThreadSelected,thirdPartyMcpAllowed:eR.thirdPartyMcpAllowed,supportsAttachments:tK,disabled:e.disabled,extraToolbar:eb,showPlanningToggle:e.showPlanningToggle,chatCommand:ti,isCopilotSpace:t_,isAgentTaskSubmitInProgress:e8}),eA[157]=tD,eA[158]=ti,eA[159]=eJ,eA[160]=e8,eA[161]=t_,eA[162]=e.disabled,eA[163]=e.modes,eA[164]=e.onNewThreadSelected,eA[165]=e.showPlanningToggle,eA[166]=eR.thirdPartyMcpAllowed,eA[167]=tq,eA[168]=tb,eA[169]=tK,eA[170]=t4,eA[171]=eb,eA[172]=ej):ej=eA[172],eA[173]!==ez||eA[174]!==ep||eA[175]!==ef||eA[176]!==eS||eA[177]!==ej?(ew=(0,r.jsxs)("form",{className:ep,ref:ez,...eg,children:[ef,eS,ej]}),eA[173]=ez,eA[174]=ep,eA[175]=ef,eA[176]=eS,eA[177]=ej,eA[178]=ew):ew=eA[178],eA[179]!==tZ||eA[180]!==ew?(eN=(0,r.jsx)(I.tL,{commands:tZ,children:ew}),eA[179]=tZ,eA[180]=ew,eA[181]=eN):eN=eA[181],eA[182]!==tk||eA[183]!==ta||eA[184]!==tM||eA[185]!==e5?(eI=(0,r.jsx)(eH,{inputRef:e5,inputOnChange:ta,anchorRef:tR,panel:tk,onPanelChange:tP,initialRepo:tM,onRepoSelect:tO}),eA[182]=tk,eA[183]=ta,eA[184]=tM,eA[185]=e5,eA[186]=eI):eI=eA[186],eA[187]!==tH||eA[188]!==t_||eA[189]!==eR.attachmentProcessingType||eA[190]!==eR.isWaitingOnAttachment||eA[191]!==tK?(eE=tK&&!t_&&(0,r.jsx)(tL.A,{onFilesDrop:tH,isUploading:eR.isWaitingOnAttachment&&"file-upload"===eR.attachmentProcessingType}),eA[187]=tH,eA[188]=t_,eA[189]=eR.attachmentProcessingType,eA[190]=eR.isWaitingOnAttachment,eA[191]=tK,eA[192]=eE):eE=eA[192],eA[193]!==eN||eA[194]!==eI||eA[195]!==eE?(eT=(0,r.jsxs)(r.Fragment,{children:[eN,eI,eE]}),eA[193]=eN,eA[194]=eI,eA[195]=eE,eA[196]=eT):eT=eA[196],eT},t5=(0,m.memo)(e=>{let{chatCommand:t,extraToolbar:a,currentMode:n,supportsAttachments:i,submitDisabled:s,isCopilotSpace:o,isAgentTaskSubmitInProgress:c=!1}=e,d="task"!==t&&"loop"!==t&&"spark"!==t,m=!!(e.onNewThreadSelected&&n.supportsModelSwitching&&d);return(0,r.jsxs)("div",{className:(0,C.$)(tg.toolbar,{[tg.toolbarNoModes]:1===e.modes.length}),children:[e.modes.length>1&&(0,r.jsxs)("div",{className:tg.mode,children:[(0,r.jsx)("div",{className:tg.modeSelectorMobile,children:(0,r.jsxs)(l.W,{children:[(0,r.jsx)(l.W.Button,{className:tg.modeSelectButton,leadingVisual:n.icon,variant:"invisible",trailingAction:T.TriangleDownIcon,children:n.name}),(0,r.jsx)(l.W.Overlay,{width:"auto",children:(0,r.jsx)(u.l,{selectionVariant:"single",role:"menu","aria-label":"Item",children:e.modes.map(t=>(0,r.jsxs)(u.l.Item,{selected:n.name===t.name,onSelect:()=>{e.onClickMode?.(t.name)},children:[(0,r.jsx)(u.l.LeadingVisual,{children:t.icon}),t.name]},t.name))})})]})}),(0,r.jsx)("div",{className:tg.modeSelectorDesktop,children:(0,r.jsx)(R.I,{className:tg.lighterSegmentedControl,"aria-label":"Mode switcher",onChange:t=>{e.modes[t]&&e.onClickMode?.(e.modes[t].name)},children:e.modes.map(e=>(0,r.jsx)(R.I.Button,{className:tg.modeButton,selected:e.name===n.name,children:e.name},e.name))})})]}),(0,r.jsxs)("div",{className:tg.extra,children:[i&&(0,r.jsx)(k.Q,{ref:e.attachmentButtonRef,leadingVisual:T.PlusIcon,variant:"invisible","aria-label":o?"Add files":"Add repositories, files, and spaces",className:tg.attachmentButton,onClick:e.addAttachment,"data-testid":"attachment-menu-button",children:(0,r.jsx)("span",{className:(0,C.$)(tg.attachmentButtonText,{"sr-only":"task"===t}),children:o?"Add files":"Add repositories, files, and spaces"})}),j.W.showDeepCodeSearchButton&&(0,r.jsx)(I.N5,{commandId:"copilot-chat:deep-codesearch",icon:T.RocketIcon,variant:"invisible",tooltipDirection:"s",className:(0,C.$)({[tg.clicked]:e.deepCodeSearch})}),a,!j.W.spacesAsAttachmentsEnabled&&n.supportsSpaces&&(0,r.jsx)(w,{}),j.W.planningAgent&&!j.W.chatInputCommands&&e.showPlanningToggle&&(0,r.jsx)(tH,{})]}),(0,r.jsxs)("div",{className:(0,C.$)(tg.actions,{[tg.actionsMultiple]:m}),children:[m&&(0,r.jsx)(tW.Yb,{onNewThreadSelected:e.onNewThreadSelected,disabled:e.disabled}),(0,r.jsxs)("div",{className:tg.toolbarButtons,children:[j.W.copilotThirdPartyMcp&&n.supportsMCP&&e.thirdPartyMcpAllowed&&d&&(0,r.jsx)(tU,{}),e.stoppable?(0,r.jsx)(t4,{}):(0,r.jsx)(t3,{disabled:s,label:n.submitLabel,isAgentTaskSubmitInProgress:c})]})]})]})});function t3(e){let t,a=(0,i.c)(4),{disabled:n,label:s,isAgentTaskSubmitInProgress:o}=e,l=void 0!==o&&o;return a[0]!==n||a[1]!==l||a[2]!==s?(t=l?(0,r.jsx)("div",{className:"d-flex flex-items-center height-full mx-2",children:(0,r.jsx)(d.A,{size:"small"})}):n?(0,r.jsx)(L.K,{variant:"invisible",size:"medium",icon:T.PaperAirplaneIcon,"aria-label":s||"Sending a message is unavailable",inactive:!0,"aria-disabled":!0}):(0,r.jsx)(I.N5,{commandId:"copilot-chat:send-message",variant:"invisible",size:"medium",icon:T.PaperAirplaneIcon,"aria-label":s||"Send now"}),a[0]=n,a[1]=l,a[2]=s,a[3]=t):t=a[3],t}function t4(){let e,t=(0,i.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(I.N5,{...(0,N.G)("copilot-chat-stop-button"),commandId:"github:cancel",variant:"invisible",size:"medium",icon:T.SquareFillIcon,tooltipDirection:"s",className:tg.CommandIconButton}),t[0]=e):e=t[0],e}t5.displayName="ChatInputToolbar";try{t2.displayName||(t2.displayName="ChatInput")}catch{}try{t3.displayName||(t3.displayName="SubmitButton")}catch{}try{t4.displayName||(t4.displayName="StopButton")}catch{}function t7(e){return"user"===e.role}function t6(e){return"attachment-types"===e?null:"attachment-types"}function t8(e){return e.type.startsWith("image/")}},71363:(e,t,a)=>{a.d(t,{FZ:()=>j,X1:()=>I});var n,r=a(74848),i=a(21728),s=a(69599),o=a(53419),l=a(33544),c=a(29731),d=a(5524),u=a(18096),m=a(34164),h=a(96540),p=a(40961),g=a(26408),f=a(25641),y=a(79064),x=a(2635),v=a(33592);let C=e=>{let t,a,n,s=(0,i.c)(6),{children:o,delay:l,assertive:c}=e,d=void 0===l?500:l,[u,m]=(0,h.useState)(!1);if(s[0]!==d?(t=()=>{m(!1);let e=setTimeout(()=>m(!0),d);return()=>clearTimeout(e)},a=[d,m],s[0]=d,s[1]=t,s[2]=a):(t=s[1],a=s[2]),(0,h.useEffect)(t,a),!u)return null;let p=void 0!==c&&c?"assertive":"polite";return s[3]!==o||s[4]!==p?(n=(0,r.jsx)("div",{role:"alert","aria-live":p,"aria-atomic":"true",children:o}),s[3]=o,s[4]=p,s[5]=n):n=s[5],n};try{C.displayName||(C.displayName="DelayedComponent")}catch{}var _=a(35673);let S={ActionList:"RepoSelectPanel-module__ActionList--ud9yE",emptyStateMessage:"RepoSelectPanel-module__emptyStateMessage--qQwDm",CopilotRepoSelectPanelAnchored:"RepoSelectPanel-module__CopilotRepoSelectPanelAnchored--mTBrm"};var b=a(27844);function j(e){let t,a,n,s,o=(0,i.c)(12),{currentReferences:l}=(0,x.Pk)(),c=(0,v.b)();o[0]!==l?(a=new Set((t=l.filter(N)).map(w)),o[0]=l,o[1]=t,o[2]=a):(t=o[1],a=o[2]);let d=a,[u,m]=(0,h.useState)();o[3]!==c||o[4]!==e||o[5]!==t?(n=async a=>{m(void 0);let n=t.find(e=>e.id===a);if(n)return void c.removeReference(n);let r=await c.service.fetchRepo(a);if(!r.ok){m("Error: failed to attach repository. Please try again."),e.onOpenChange(!0);return}let i=(0,f.qS)(r.payload);c.addReference(i,"repoMenu")},o[3]=c,o[4]=e,o[5]=t,o[6]=n):n=o[6];let p=n;return o[7]!==u||o[8]!==e||o[9]!==d||o[10]!==p?(s=(0,r.jsx)(I,{...e,selectionVariant:"multiple",selectedRepoIds:d,onSelectRepo:p,description:"Choose repositories to chat about.",error:u}),o[7]=u,o[8]=e,o[9]=d,o[10]=p,o[11]=s):s=o[11],s}function w(e){return e.id}function N(e){return"repository"===e.type}function I(e){let t,a,n,f,y,v,j,w,N,I,A,R,k,L,P,M,O,D,F,B=(0,i.c)(52),{open:$,onOpenChange:z,submitReturnFocusRef:U,cancelReturnFocusRef:W,selectedRepoIds:V,featuredRepoIds:H,onSelectRepo:q,selectionVariant:K,description:G,error:Q,ownerDisplayLogin:Z,includeForks:J,anchorRef:Y}=e,X=void 0===H?V:H,{ssoOrganizations:ee}=(0,x.Pk)(),[et,ea]=(0,h.useState)("");B[0]!==$?(t=()=>{$||ea("")},a=[$],B[0]=$,B[1]=t,B[2]=a):(t=B[1],a=B[2]),(0,h.useEffect)(t,a);let{repositories:en,loading:er}=(0,g.U)(et,$,void 0,Z,void 0!==J&&J);e:{if(er){n="Loading repositories";break e}if(0===en.length){n="No repositories found";break e}if(1===en.length){n="1 repository found";break e}n=`${en.length} repositories found`}let ei=n;B[3]===Symbol.for("react.memo_cache_sentinel")?(f=e=>{ea(e.currentTarget.value)},B[3]=f):f=B[3];let es=f;t:{let e;if(!ee){let e;B[4]===Symbol.for("react.memo_cache_sentinel")?(e=[],B[4]=e):e=B[4],y=e;break t}B[5]!==ee?(e=ee.map(T),B[5]=ee,B[6]=e):e=B[6],y=e}let eo=y;B[7]!==X?(v=e=>X.has(e.databaseId)?"featuredRepos":"nonFeaturedRepos",B[7]=X,B[8]=v):v=B[8];let{featuredRepos:el,nonFeaturedRepos:ec}=function(e,t){let a={};for(let n of e){let e=t(n);a[e]??(a[e]=[]),a[e].push(n)}return a}(en,v),[ed,eu]=(0,h.useState)(!1);B[9]!==q?(j=async e=>{eu(!0),await q(e),eu(!1)},B[9]=q,B[10]=j):j=B[10];let em=j;B[11]===Symbol.for("react.memo_cache_sentinel")?(w=(0,c.G)("repo-select-panel"),B[11]=w):w=B[11];let eh=u.X,ep=Y&&S.CopilotRepoSelectPanelAnchored;B[12]!==ep?(N=(0,m.$)(ep),B[12]=ep,B[13]=N):N=B[13],B[14]!==W||B[15]!==z?(I=()=>{(0,p.flushSync)(()=>z(!1)),W.current?.focus(),(0,o.BI)("dotcom_chat.activate",{target:"REPOSITORY_DIALOG_CLOSE",mode:"immersive"})},B[14]=W,B[15]=z,B[16]=I):I=B[16],B[17]!==z||B[18]!==U?(A=()=>{(0,p.flushSync)(()=>z(!1)),U.current?.focus()},B[17]=z,B[18]=U,B[19]=A):A=B[19];let eg=Y?"anchored":"modal",ef="multiple"===K?"Select repositories":"Select a repository",ey=eo.length>0&&"border-bottom-0";B[20]!==ey?(R=(0,m.$)(ey),B[20]=ey,B[21]=R):R=B[21];let ex=!0===er||ed;B[22]!==ex?(k=(0,r.jsx)(u.X.SearchInput,{loading:ex,onChange:es,placeholder:"Search repositories","aria-label":"Search repositories"}),B[22]=ex,B[23]=k):k=B[23],B[24]!==R||B[25]!==k?(L=(0,r.jsx)(u.X.Header,{className:R,children:k}),B[24]=R,B[25]=k,B[26]=L):L=B[26],B[27]!==Z||B[28]!==eo?(P=(void 0===Z||""===Z)&&!(0,s.G7)("global_sso_banner")&&(0,r.jsx)(l.x,{portalContainerName:_.f1,protectedOrgs:eo,redirectURI:E,useFullWidthStyle:!0}),B[27]=Z,B[28]=eo,B[29]=P):P=B[29],B[30]===Symbol.for("react.memo_cache_sentinel")?(M=(0,r.jsx)(_.hl,{}),B[30]=M):M=B[30],B[31]!==Q?(O=Q&&(0,r.jsx)(u.X.Message,{variant:"error",size:"inline",children:Q}),B[31]=Q,B[32]=O):O=B[32];let ev="initial"===er?(0,r.jsxs)("div",{className:S.ActionList,children:[(0,r.jsx)("div",{className:"sr-only",children:ei}),(0,r.jsx)(u.X.Loading,{children:"Fetching repositories\u2026"})]}):0!==en.length||er?(0,r.jsxs)(d.l,{className:S.ActionList,children:[(0,r.jsx)("div",{className:"sr-only",children:ei}),el?.map(e=>(0,r.jsx)(b.W,{repo:e,onSelect:em,selected:V.has(e.databaseId)},e.databaseId)),el&&ec&&(0,r.jsx)(d.l.Divider,{}),ec?.map(e=>(0,r.jsx)(b.W,{repo:e,onSelect:em,selected:V.has(e.databaseId)},e.databaseId))]}):(0,r.jsxs)("div",{className:S.ActionList,children:[(0,r.jsx)("div",{className:"sr-only",children:ei}),(0,r.jsx)("div",{className:S.emptyStateMessage,children:(0,r.jsx)(C,{delay:750,children:(0,r.jsx)(u.X.Message,{variant:"empty",title:"No repositories found",children:"Try a different search term"})})})]});return B[33]!==eh||B[34]!==Y||B[35]!==G||B[36]!==$||B[37]!==K||B[38]!==N||B[39]!==I||B[40]!==A||B[41]!==eg||B[42]!==ef||B[43]!==L||B[44]!==P||B[45]!==M||B[46]!==O||B[47]!==ev?(D=(0,r.jsxs)(eh,{className:N,width:"large",maxHeight:"xlarge",onCancel:I,onSubmit:A,open:$,variant:eg,selectionVariant:K,title:ef,description:G,anchorRef:Y,children:[L,P,M,O,ev]}),B[33]=eh,B[34]=Y,B[35]=G,B[36]=$,B[37]=K,B[38]=N,B[39]=I,B[40]=A,B[41]=eg,B[42]=ef,B[43]=L,B[44]=P,B[45]=M,B[46]=O,B[47]=ev,B[48]=D):D=B[48],B[49]!==w||B[50]!==D?(F=(0,r.jsx)("div",{...w,children:D}),B[49]=w,B[50]=D,B[51]=F):F=B[51],F}function E(){return`/search/refresh_blackbird_caches?return_to=${location.href}`}function T(e){return e.login}try{(n=function(e){let t,a,n,s=(0,i.c)(9),{selectedThreadID:o,currentTopic:l}=(0,x.Pk)(),c=(0,v.b)();s[0]!==c||s[1]!==o?(t=async e=>{y.Jt.setSelectedTopic(o??"",e.toString()),c.clearCurrentReferences(["image","issue"]),await c.fetchCurrentRepo(e)},s[0]=c,s[1]=o,s[2]=t):t=s[2];let d=t;return s[3]!==l?(a=new Set(l?[l.id]:[]),s[3]=l,s[4]=a):a=s[4],s[5]!==d||s[6]!==e||s[7]!==a?(n=(0,r.jsx)(I,{...e,selectionVariant:"instant",selectedRepoIds:a,onSelectRepo:d,description:"Choose a repository to chat about."}),s[5]=d,s[6]=e,s[7]=a,s[8]=n):n=s[8],n}).displayName||(n.displayName="RepoTopicSelectPanel")}catch{}try{j.displayName||(j.displayName="RepoReferencesSelectPanel")}catch{}try{I.displayName||(I.displayName="RepoSelectPanel")}catch{}},72011:(e,t,a)=>{a.d(t,{A2:()=>m,CT:()=>c,Lr:()=>d,O6:()=>o,dp:()=>l,ee:()=>u});var n=a(25641),r=a(23657),i=a(96379);let s="/github-copilot/chat",o=["copilot-chat","custom-copilots"];function l(e){return e?["copilot-chat","custom-copilot",{id:e.id,owner:e.owner}]:["copilot-chat","custom-copilot",null]}async function c(){let e=await (0,i.lS)(`${s}/custom_copilots`);if(!e.ok)throw Error(`Failed to fetch spaces: ${n.nN[e.status]||n.DW}`);return await e.json()}async function d(e){if(!e||!e.owner)return{status:500,ok:!1,error:"unexpected null custom copilot id or missing owner"};let{owner:t,id:a}=e,r=`${s}/custom_copilots/${t}/${a}`,o=await (0,i.lS)(r);if(!o.ok)return{status:o.status,ok:!1,error:n.nN[o.status]||n.DW};let l=await o.json();return{status:o.status,ok:!0,payload:l}}async function u(e){let t=await (0,i.lS)((0,r.fn)(e),{method:"DELETE"});return t.ok?{status:t.status,ok:!0,payload:null}:t}async function m(e){let t=await (0,i.lS)(`${(0,r.fn)(e)}/settings/visibility`);if(!t.ok)throw Error("Error fetching visibility settings");try{let e=await t.json();return{memberCount:e.member_count&&"number"==typeof e.member_count?e.member_count:null}}catch(e){throw Error(`Error parsing visibility settings: ${e}`)}}},72439:(e,t,a)=>{a.d(t,{E:()=>CopilotTextAttacher,x:()=>o});var n=a(50467),r=a(53419),i=a(25641),s=a(23967);let o="application/x.clipboard",l=/^\s*`?([\w-_]{3,40}\.\w{1,10})`?\s*$/;let CopilotTextAttacher=class CopilotTextAttacher{static async isAttachable(e){if(e.size>CopilotTextAttacher.getAttachmentSizeLimit())return!1;let t=await e.text();return CopilotTextAttacher.isPlainText(t)}static getTextFileExtensions(){return CopilotTextAttacher.fileExtensionsCache??(CopilotTextAttacher.fileExtensionsCache=Object.values(s.r4).flatMap(e=>e.extensions??[]).filter(e=>"stl"!==e).join(","))}static getAttachmentSizeLimit(){return 512e3}static isPlainText(e){let t=Math.min(e.length,1e3),a=0,n=0;for(let r=0;r127&&n++}let r=a/t,i=n/t;return r<=.1&&i<=.2}async makeReference(e,t){let a=await e.text(),n=e.name||(t?await t:await this.generateFileName(a,e.type));return this.makeReferenceSync(a,n)}makeReferenceSync(e,t){let a=t.split(".").pop();return(0,r.BI)("copilot.attach_pasted_file",{extension:a,characters:e.length}),{type:"thread-scoped-file",name:t,text:e,language:""}}async addAttachment(e,t,a){let n;if(e.size>CopilotTextAttacher.getAttachmentSizeLimit())return void this.manager.addAmbientError("Attached text files must be smaller than 500KB");let r=await e.text();if(!CopilotTextAttacher.isPlainText(r))return void this.manager.addAmbientError(`"${e.name}" has an unsupported file type. Please try again with a plain text file`);if(a)n=this.makeReferenceSync(r,a),this.manager.addReference(n,"text-attacher");else{let a=(0,i.Vc)(e.name);this.manager.addReference(a,"text-attacher"),this.manager.dispatch({type:"WAITING_ON_ATTACHMENT",loading:!0,attachmentType:"file-upload"});try{n=await this.makeReference(e,t),this.manager.replaceReference(a,n)}catch{this.manager.addAmbientError("Failed to process file. Please try again."),this.manager.removeReference(a)}finally{this.manager.dispatch({type:"WAITING_ON_ATTACHMENT",loading:!1})}}return n}async generateFileName(e,t){let a=this.existingFileNames.size>0?` Follow the naming formats used by these existing files: ${Array.from(this.existingFileNames).slice(0,5).join(", ")}`:"",n=await this.manager.service.getSimpleCompletion(`Return a suitable filename for the following file contents. Follow the file naming conventions of the language and do not include any special characters except for period, underscore or hyphens. Try to limit the name to 20 characters or less. You MUST include the file extension. Include only the filename in your response and nothing else.${a} File contents: \`\`\` ${e} \`\`\` `),i=n.ok?l.exec(n.payload)?.[1]:null;return i?(0,r.BI)("copilot.generate_pasted_file_name.success"):(0,r.BI)("copilot.generate_pasted_file_name.failure"),this.uniqueFileName(i??this.defaultFileName(t))}uniqueFileName(e){if(!this.existingFileNames.has(e))return e;let t=e.lastIndexOf("."),a=t>0&&t{a.d(t,{l:()=>n});let n=()=>void 0},73900:(e,t,a)=>{a.d(t,{Kq:()=>SoftNavErrorEvent,RQ:()=>SoftNavEndEvent,gh:()=>SoftNavPayloadEvent,ni:()=>SoftNavSuccessEvent,sW:()=>SoftNavStartEvent});var n=a(50467),r=a(82591);let i=class SoftNavEvent extends Event{constructor(e,t){super(t),(0,n._)(this,"mechanism",void 0),this.mechanism=e}};let SoftNavStartEvent=class SoftNavStartEvent extends i{constructor(e){super(e,r.z.START)}};let SoftNavSuccessEvent=class SoftNavSuccessEvent extends i{constructor(e,t){super(e,r.z.SUCCESS),(0,n._)(this,"visitCount",void 0),this.visitCount=t}};let SoftNavErrorEvent=class SoftNavErrorEvent extends i{constructor(e,t){super(e,r.z.ERROR),(0,n._)(this,"error",void 0),this.error=t}};let SoftNavEndEvent=class SoftNavEndEvent extends i{constructor(e){super(e,r.z.END)}};let SoftNavPayloadEvent=class SoftNavPayloadEvent extends Event{constructor(e){super("soft-nav:payload"),(0,n._)(this,"payload",void 0),(0,n._)(this,"appPayload",void 0),this.payload=e.payload,this.appPayload=e.appPayload}}},76166:(e,t,a)=>{a.d(t,{d:()=>r});var n=a(53419);function r(e,t){(0,n.BI)("dotcom_chat.vision.error",{type:e,...t})}},76629:(e,t,a)=>{a.d(t,{BP:()=>u,D3:()=>d,O8:()=>l});var n=a(74848),r=a(21728),i=a(96540),s=a(71315),o=a(88431);let l={ServerRender:"ServerRender",ClientHydrate:"ClientHydrate",ClientRender:"ClientRender"},c=(0,i.createContext)(l.ClientRender);function d(e){let t,a,d,u,m=(0,r.c)(8),{wasServerRendered:h,children:p}=e;m[0]!==h?(t=()=>s.X3?l.ServerRender:h?l.ClientHydrate:l.ClientRender,m[0]=h,m[1]=t):t=m[1];let[g,f]=(0,i.useState)(t);return m[2]!==g?(a=()=>{g!==l.ClientRender&&f(l.ClientRender)},d=[g],m[2]=g,m[3]=a,m[4]=d):(a=m[3],d=m[4]),(0,o.N)(a,d),m[5]!==p||m[6]!==g?(u=(0,n.jsx)(c.Provider,{value:g,children:p}),m[5]=p,m[6]=g,m[7]=u):u=m[7],u}function u(){return(0,i.useContext)(c)}try{c.displayName||(c.displayName="RenderPhaseContext")}catch{}try{d.displayName||(d.displayName="RenderPhaseProvider")}catch{}},76872:(e,t,a)=>{a.d(t,{D:()=>v});var n=a(74848),r=a(23657),i=a(84646),s=a(96459),o=a(24990),l=a(15220),c=a(46251),d=a(86877),u=a(99511),m=a(96540),h=a(51563),p=a(6236);let g={createSpaceDialog:"CreateSpaceDialog-module__createSpaceDialog--YECfV"};var f=a(44956),y=a(53419),x=a(20263);function v({dialogTitle:e="New Space",closeDialog:t,initialSpace:a}){let v=(0,s.Z)(),C=(0,m.useRef)(null),_=(0,i.AV)(),[S,b]=(0,m.useState)(a?.name??_),[j,w]=(0,m.useState)(null),[N,I]=(0,m.useState)({}),{upsertCopilotSpace:E,isPending:T}=(0,h.$)(),A=(0,o.S)(),R=(0,m.useCallback)(e=>{let t={...N};for(let a of e)t[a]&&delete t[a];I(t)},[N]),k=(0,m.useCallback)(e=>w(e),[]);(0,m.useEffect)(()=>{(0,y.BI)("copilot_spaces.create_space_v3_dialog_opened",{})},[]),(0,m.useEffect)(()=>{a?C.current?.focus():C.current?.select()},[a]);let L=async()=>{if(T)return;let e=a?.resources?[...a.resources]:[],i=[];if(a&&j){let t=function(e,t){let a=[],n=[];if("Organization"!==t.type||t.allowsPrivateReposFromOtherOrgs)return{resourcesToSave:e,resourcesThatWillNotTransfer:[]};for(let r of e)"ownerId"in r&&"private"in r&&r.private&&r.ownerId!==t.id?n.push(r):a.push(r);return{resourcesToSave:a,resourcesThatWillNotTransfer:n}}(a.resources||[],j);e=t.resourcesToSave,i=t.resourcesThatWillNotTransfer}let s=!0;if(i.length>0){let e=new Intl.ListFormat().format(Array.from(new Set(i.map(e=>e.ownerLogin).filter(e=>void 0!==e)))),t=`Private resources owned by ${e} will not be duplicated to the new space.`;s=await A({title:"Some resources will not be duplicated",content:(0,n.jsx)(x.BC,{html:t}),cancelButtonContent:"Never mind",confirmButtonContent:"Continue",confirmButtonType:"primary"})}if(s)try{let n=await E({name:S,ownerId:j?.id,ownerType:j?.type,resources:e,generalInstructions:a?.generalInstructions});I({}),t();let i=(0,r.Cb)(n);return v(i)}catch(e){I(e??{})}},P=()=>{t()};return(0,n.jsx)(l.l,{position:{narrow:"fullscreen"},title:e,onClose:t,width:"large","aria-label":e,className:g.createSpaceDialog,renderFooter:()=>(0,n.jsx)(f.m,{onCancel:P,onSave:L,isLoading:T,disabled:!j,saveButtonText:"Create Space"}),children:(0,n.jsx)("form",{onSubmit:async e=>{e.preventDefault(),e.stopPropagation(),await L()},children:(0,n.jsxs)(c.B,{children:[(0,n.jsxs)(d.A,{children:[(0,n.jsx)(d.A.Label,{required:!0,children:"Space name"}),(0,n.jsx)(u.A,{ref:C,autoFocus:!0,block:!0,"data-testid":"copilot-space-name-input",name:"copilot-space-name",value:S,onChange:e=>{b(e.target.value),R(["name","slug"])}}),(0,n.jsx)(d.A.Caption,{children:"Choose a name that describes your project or use case"}),N.name?(0,n.jsx)(d.A.Validation,{variant:"error",children:(0,n.jsxs)("span",{children:["Name ",N.name]})}):N.slug?(0,n.jsx)(d.A.Validation,{variant:"error",children:(0,n.jsx)("span",{children:r.j0})}):null]}),(0,n.jsx)(p.E,{onSelect:k})]})})})}try{v.displayName||(v.displayName="CreateSpaceDialog")}catch{}},77430:(e,t,a)=>{a.d(t,{r:()=>o});var n=a(74848),r=a(71315),i=a(87448),s=a(96540);let o=(0,s.forwardRef)(function({src:e,size:t=20,sx:a,...o},l){let c=(0,s.useMemo)(()=>{let a=new URL(e,r.fV.origin);return a.searchParams.has("size")||a.searchParams.has("s")||a.searchParams.set("size",String(2*Number(t))),a.toString()},[e,t]);return(0,n.jsx)(i.eu,{ref:l,src:c,size:t,"data-testid":"github-avatar",sx:a,...o})});try{o.displayName||(o.displayName="GitHubAvatar")}catch{}},77809:(e,t,a)=>{a.d(t,{Q:()=>ei});var n=a(74848),r=a(26108),i=a(15220),s=a(46251),o=a(86877),l=a(21373),c=a(72511),d=a(38621),u=a(96540),m=a(97564),h=a(54030),p=a(39176),g=a(54114),f=a(71363),y=a(78314),x=a(31078),v=a(53552),C=a(64375),_=a(29731),S=a(6665),b=a(19189),j=a(7808),w=a(64642),N=a(65787),I=a(25407),E=a(66108),T=a(94195),A=a(96459),R=a(11683),k=a(45800),L=a(31604),P=a(87448),M=a(10095),O=a(91385),D=a(70170),F=a(37272),B=a(71315),$=a(34164);let z=u.forwardRef(({ariaActiveDescendant:e,ariaControls:t,ariaExpanded:a,ariaHasPopup:r,className:i,onBlur:s,onFocus:o,onKeyDown:l,onPreload:c,onSearch:m,query:h,searchPlaceholder:p,loading:g,sx:f},y)=>{let{sendRepoClickEvent:x}=(0,S.T)(),[v,C]=u.useState(h),_=u.useRef((0,D.s)(e=>m(e),250));u.useEffect(()=>{C(h)},[h]);let b=h?(0,n.jsx)(P.ks.Action,{onClick:()=>{x("FILE_TREE.CANCEL_SEARCH"),m("")},icon:d.XCircleFillIcon,"aria-label":"Clear",className:"fgColor-muted"}):void 0;return(0,n.jsx)(P.ks,{autoFocus:U(),className:(0,$.$)("d-flex",i),ref:y,value:v,onKeyDown:l,onChange:e=>{C(e.target.value),c(),_.current(e.target.value)},sx:f,"aria-label":p||"Go to file","aria-activedescendant":e,role:r?"combobox":void 0,"aria-controls":t,"aria-expanded":a,"aria-haspopup":r?"dialog":void 0,autoCorrect:"off",spellCheck:"false",placeholder:p||"Go to file",loading:""!==h&&g,leadingVisual:d.SearchIcon,trailingAction:b,trailingVisual:b?void 0:()=>(0,n.jsx)(F.E,{children:(0,n.jsx)("kbd",{children:"t"})}),onFocus:e=>{c(),e.target.select(),o?.(e)},onBlur:s,onClick:()=>x("FILE_TREE.SEARCH_BOX")})});function U(){return"1"===new URLSearchParams(B.fV.search).get("search")}z.displayName="FilesSearchBox";let W={Box:"FileResultsList-module__Box--cUmDY",ActionList:"FileResultsList-module__ActionList--kDNEZ",FilesSearchBox:"FileResultsList-module__FilesSearchBox--KW9Zl",HighlightMatch:"FileResultsList-module__HighlightMatch--Jy_cG",Octicon:"FileResultsList-module__Octicon--PvMf4"},V={excludeDirectories:!1,excludeSeeAllResults:!1};function H({actionListSx:e,additionalResults:t,className:a,commitOid:r,config:i=V,findFileWorkerPath:s,getItemUrl:o,onRenderRow:l,onItemSelected:d,searchBoxRef:m,sx:p}){let{excludeDirectories:g,excludeSeeAllResults:f}=i,{query:C,setQuery:_}=(0,x.JS)(),E=(0,y.t)(),M=u.useRef(null),O=m??M,[D,F]=u.useState(C.length>0),[B,$]=u.useState(!!C),{list:H,directories:q,loading:K,error:G}=(0,h.o)(r,D,!!g),{path:Z}=(0,v.eu)(),{getUrl:J}=(0,b.Z)(),{queryText:Y,queryLine:X}=function(e){let t=(e=e.replaceAll(" ","")).indexOf(":");return t>=0?{queryText:e.substring(0,t),queryLine:parseInt(e.substring(t+1),10)}:{queryText:e,queryLine:void 0}}(C),{matches:ee,clearMatches:et}=function(e,t,a,n){let[r,i]=u.useState(),s=u.useRef(""),o=u.useRef(),{sendStats:l}=(0,S.T)(),c=u.useRef(!1),d=u.useCallback(()=>{let e=new j.z(a,w.j);e.onmessage=({data:e})=>{c.current=!1,i(e.list),s.current=e.query,e.startTime&&l("repository.find-file",{"find-file-base-count":e.baseCount,"find-file-results-count":e.list.length,"find-file-duration-ms":performance.now()-e.startTime})},o.current=e},[l,a]);return u.useEffect(()=>{if(n)return d(),function(){o.current?.terminate()}},[d,n]),u.useEffect(()=>{if(e.length&&t){c.current&&(o.current?.terminate(),d());let a=s.current&&t.startsWith(s.current);c.current=!0,o.current?.postMessage({baseList:a&&r||e,query:t,startTime:performance.now()})}},[e,t,d]),{matches:r,clearMatches:()=>i(void 0)}}((0,u.useMemo)(()=>[...H,...t??[]].sort(),[t,H]),Y,s,D),{sendRepoClickEvent:ea}=(0,S.T)(),en=(0,A.Z)(),[er,ei]=u.useState(0),[es,eo]=u.useState(()=>U()),el=u.useRef(null),ec=u.useRef(null),ed="file-results-list",{sendRepoKeyDownEvent:eu}=(0,S.T)(),{screenSize:em}=(0,T.lm)(),eh=i.enableOverlay??em>=T.Gy.large,ep=u.useCallback(e=>{ea("FILE_TREE.SEARCH_RESULT_CLICK"),d?.(e),$(!1)},[ea,d]),eg=(e,t,a)=>o?o(e,t,a):J({path:e,action:t?"tree":"blob",hash:a}),{containerRef:ef}=(0,k.G)({bindKeys:R.z0.ArrowVertical|R.z0.HomeAndEnd,focusInStrategy:"previous"},[K,G]);u.useEffect(()=>{C||$(!1)},[C]),u.useEffect(()=>{document.activeElement!==O.current&&eh&&$(!1)},[Z,O,eh]);let ey=ee?.slice(0,20)||[],ex=ee&&ee.length>ey.length,ev=!i.disableNavigation,eC=ec.current?.getBoundingClientRect().width,e_=(0,n.jsx)(P.az,{sx:{maxHeight:eh?"180px":"100% !important",width:eh?eC:"100%"},className:W.Box,children:G?(0,n.jsx)(c.A,{variant:"danger",className:"m-3",children:"Failed to search"}):(0,n.jsxs)(P.lF,{ref:ef,sx:{p:eh?2:3,pr:3*!!eh,pt:eh?3:"2px !important",...e},role:"listbox",className:W.ActionList,children:[!K&&ey.map((e,t)=>{let a=q.includes(e),r=eg(e,a,X?`L${X}`:"");return(0,n.jsx)(Q,{active:!1,index:t,focused:es&&er===t,match:e,onRender:l,query:Y,onClick:ep,isDirectory:a,to:r,useOverlay:eh,listRef:ef,noAnchor:i.disableNavigation},e)}),0===ey.length&&(0,n.jsx)("div",{role:"status",className:"text-center fgColor-muted",children:"No matches found"})]})});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P.az,{className:a,ref:ec,sx:p,children:(0,n.jsx)(z,{ariaActiveDescendant:(!eh&&C||eh&&B)&&es&&er>-1?ex&&er===ey.length?"see-all-results-link":`file-result-${er}`:void 0,ariaExpanded:eh?B:void 0,ariaHasPopup:eh,ariaControls:eh?ed:void 0,ref:O,loading:K,query:C,onKeyDown:e=>{let{key:t,shiftKey:a,metaKey:n,altKey:r,ctrlKey:i}=e;if(!a&&!n&&!r){if("Escape"===t)C?(eu("FILE_TREE.CANCEL_SEARCH"),_(""),et()):document.activeElement&&document.activeElement.blur();else if(!C)return;else if("Enter"===t){if(!f&&ex&&er===ey.length)ev&&en((0,I.Y8Y)({owner:E.ownerLogin,repo:E.name,searchTerm:`path:${Y}`})),d?.();else if(ey[er]){let e=ey[er];ev&&en(eg(ey[er],!1,X?`L${X}`:"")),$(!1),d?.(e)}}else if("ArrowDown"===t||i&&"n"===t){if(!f&&ex&&er>=ey.length-1){if(ei(ey.length),el.current&&ef.current){let e=(0,N.U)(ef.current);(0,R.Rt)(el.current,e,{behavior:"instant"})}}else ei(Math.min(er+1,ey.length-1));e.preventDefault();return}else if("ArrowUp"===t||i&&"p"===t){ei(Math.max(er-1,0)),e.preventDefault();return}}},onPreload:()=>F(!0),onSearch:e=>{_(e),e?$(!0):(et(),$(!1)),ei(0)},onBlur:e=>{ef.current?.contains(e.relatedTarget)||($(!1),eo(!1))},onFocus:()=>{C&&$(!0),eo(!0)},searchPlaceholder:i.searchPlaceholder,className:W.FilesSearchBox})}),eh&&ey.length>0&&(0,n.jsx)(L.T,{anchorRef:ec,open:eh&&B,renderAnchor:null,onClose:()=>{$(!1)},focusZoneSettings:{disabled:!0},focusTrapSettings:{disabled:!0},align:"end",overlayProps:{id:ed,role:"dialog"},children:e_}),!eh&&C&&e_]})}let q=({active:e,focused:t,index:a,match:r,query:i,to:s,isDirectory:o,onClick:l,onRender:c,useOverlay:d,listRef:m,noAnchor:h})=>{let p=(0,O.Xq)(i,r);c?.();let g=u.useRef(null);u.useEffect(()=>{if(t&&g.current&&m?.current){let e=(0,N.U)(m.current);(0,R.Rt)(g.current,e,{behavior:"instant"})}},[t,m]);let f={};t&&(f={outline:"none",border:"2 solid",boxShadow:"0 0 0 2px #0969da"});let y={id:`file-result-${a}`,active:e,onSelect:(0,u.useCallback)(()=>{l?.(r)},[r,l]),sx:{fontWeight:"normal",":hover":{textDecoration:"none"},mx:"2px",width:"calc(100% - 4px)",...f},role:"option","data-focus-visible-added":t||void 0,tabIndex:d?-1:0},x=(0,n.jsx)("div",{className:"d-flex",children:(0,n.jsx)("div",{className:"d-flex flex-1 flex-column overflow-hidden",children:(0,n.jsx)(Z,{text:r,positionsList:p,LeadingIcon:o?K:G,className:W.HighlightMatch})})});return h?(0,n.jsx)(P.lF.Item,{...y,children:x},r):(0,n.jsx)(P.lF.LinkItem,{...y,ref:g,as:E.N,to:s,children:x},r)},K=()=>(0,n.jsx)(M.A,{"aria-label":"Directory",icon:d.FileDirectoryFillIcon,size:"small",className:W.Octicon}),G=()=>(0,n.jsx)(M.A,{"aria-label":"File",icon:d.FileIcon,className:"fgColor-muted mr-2",size:"small"}),Q=u.memo(q);function Z({className:e,text:t,positionsList:a,sx:r,LeadingIcon:i}){let s=[],o=0;for(let e of a){if(Number(e)!==e||et.length)continue;let a=t.slice(o,e);a&&s.push(J(a)),o=e+1,s.push((0,n.jsx)("mark",{className:"text-bold bgColor-transparent fgColor-default",children:t[e]},e))}return s.push(J(t.slice(o))),(0,n.jsx)(P.az,{className:e,sx:r,children:(0,n.jsxs)(n.Fragment,{children:[i&&(0,n.jsx)(i,{}),s]})})}function J(e){return e.replaceAll("/","/\u200B")}try{H.displayName||(H.displayName="FileResultsList")}catch{}try{q.displayName||(q.displayName="FileResultRow")}catch{}try{K.displayName||(K.displayName="DirectoryIcon")}catch{}try{G.displayName||(G.displayName="FileResultIcon")}catch{}try{Q.displayName||(Q.displayName="MemoizedFileResultRow")}catch{}try{Z.displayName||(Z.displayName="HighlightMatch")}catch{}let Y={dialogHeader:"MultiFilePicker-module__dialogHeader--CApsB",Box:"MultiFilePicker-module__Box--gINxM",Dialog:"MultiFilePicker-module__Dialog--ls9MF"};var X=a(73017),ee=a(53419);function et(e,t,a){return{id:`${a.id}${"github_folder"===t?"-folder":""}-${e}`,repositoryId:a.id,nwo:`${a.ownerLogin}/${a.name}`,filePath:e,type:t}}function ea(e,t,a,n,r,i){let s=Array.from(e).filter(e=>t.has(e)),o=Array.from(e).filter(e=>!t.has(e));if(!i)return o.map(e=>et(e,"github_file",a));let l=[],c=new Set;for(let e of s){if(s.some(t=>t!==e&&e.startsWith(`${t}/`)))continue;let t=o.filter(t=>t.startsWith(`${e}/`));if(i&&0===t.length){l.push(et(e,"github_folder",a));continue}if(i&&t.length>=r)for(let n of(l.push(et(e,"github_folder",a)),t))c.add(n);else for(let e of t)l.push(et(e,"github_file",a)),c.add(e)}let d=o.filter(e=>!c.has(e));if(n&&i){let e=new Map;for(let t of d){let a=t.lastIndexOf("/"),n=a>0?t.substring(0,a):"";e.has(n)||e.set(n,[]),e.get(n)?.push(t)}for(let[t,n]of e)if(""===t)for(let e of n)l.push(et(e,"github_file",a));else l.push(et(t,"github_folder",a))}else for(let e of d)l.push(et(e,"github_file",a));return l}function en({currentRepo:e,setLocalFormData:t,fetchError:a,onFileCountChange:r,expandedPath:i,resourceCounts:s,allowFolderReferences:o,maxFileCount:l,onRejectionMessage:c,onDisplayCountChange:d}){let[m,f]=(0,u.useState)(()=>new Set),[y,x]=(0,u.useState)(()=>new Set),v=l??50,{list:C,directories:_,loading:S}=(0,h.o)(e.commitOID,!0),[b,j]=(0,u.useState)([]);(0,u.useEffect)(()=>{j((0,p.k)({paths:C,directories:_})),x(new Set(_))},[C,_,j,e.commitOID]),(0,u.useEffect)(()=>{let a=Array.from(m).filter(e=>!y.has(e)),n=Array.from(m).filter(e=>y.has(e));r?.(a.length);let i=!1;if(o&&a.length>0){let e=n.map(e=>`${e}/`),t=a.filter(t=>!e.some(e=>t.startsWith(e))),r=t.some(e=>e.includes("/"));i=t.length>v&&r}let s=ea(m,y,e,i,v,o??!1);t(s),d&&d(s.length)},[m,y,e,t,r,d,o,v]);let w=(0,u.useCallback)(t=>`/${e.name}/${e.ownerLogin}/tree/${e.refInfo.name}/${t.path}`,[e]),N=(0,u.useCallback)(t=>{if(t.size<=m.size){f(t),c?.(null);return}if(!o){let e=Array.from(t).filter(e=>!y.has(e)),a=s?s.maxResourceCount-s.currentResourceCount:v;if(e.length>a){let a=s?`${s.currentResourceCount+e.length} / ${s.maxResourceCount} possible sources selected, add fewer files.`:`Up to ${v} files can be added at a time.`;c?.(a),f(t);return}c?.(null),f(t);return}let a=Array.from(t).filter(e=>!y.has(e)),n=Array.from(t).filter(e=>y.has(e)).map(e=>`${e}/`),r=a.filter(e=>!n.some(t=>e.startsWith(t))),i=r.some(e=>e.includes("/"));if(ea(t,y,e,r.length>v&&i,v,o).length>v)return void f(t);f(t)},[m,v,y,o,c,e,s]);return(0,n.jsx)("div",{className:Y.Box,children:(0,n.jsx)(g.Rw,{rootItems:b,expandedPath:i,selectedItemRef:()=>{},setRootItems:j,navigateOnClick:!1,directoryNavigateOnClick:!1,selectedItems:m,onSelectionChange:N,loading:S||!1,fetchError:!!a,getItemUrl:w,allowFolderReferences:!!o,sortDirectoryItems:e=>e.sort((e,t)=>e.data.name.localeCompare(t.data.name))})})}function er({onClose:e}){return(0,n.jsx)(r.K,{icon:d.XIcon,"aria-label":"Close",onClick:e,variant:"invisible"})}function ei({formData:e,onCancel:t,onSaveFiles:a,findFileWorkerPath:h,attachmentButtonRef:p,owner:g,resourceCounts:S,initialRepo:b,onRepoSelect:j,hideBackButton:w=!1,allowFolderReferences:N=!1,maxFileCount:I=50}){let[E,T]=(0,u.useState)({}),[A,R]=(0,u.useState)(null),[k,L]=(0,u.useState)(b||null),[P,M]=(0,u.useState)(!0),[O,D]=(0,u.useState)(e),[F,B]=(0,u.useState)(!1),[$,z]=(0,u.useState)(null),[U,W]=(0,u.useState)(""),[V,q]=(0,u.useState)(null),[K,G]=(0,u.useState)(0),[Q,Z]=(0,u.useState)(0),J=(0,u.useRef)(!1),et=async e=>{let t;if(J.current=!0,E[e]){L(t=E[e]),j?.(t);return}try{t=await (0,m.V)(e),T(a=>({...a,[e]:t})),L(t),j?.(t),M(!1)}catch(e){R(e instanceof Error?e.message:"An unknown error occurred")}J.current=!1},ea=()=>{j?.(null),L(null),D([]),M(!0)},ei=void 0!==S,es=(ei?Q:K)>(ei?S.maxResourceCount-S.currentResourceCount:I),eo=async()=>{B(!0);try{if(es)return;(0,ee.BI)("copilot-spaces.click",{target:"SAVED_FILES_FROM_FILE_PICKER"}),await a(O)}catch(t){let e="An unknown error occurred";t&&"object"==typeof t&&"base"in t&&"string"==typeof t.base&&(e=t.base.startsWith("unsupported_file_type")&&"files"in t?function(e){if(1===e.length)return`This file can't be submitted: ${e[0]}. Only supported file types are allowed.`;let t=e.slice(0,3).map(e=>(function(e,t=30){let a=e.length<=t?e:`...${e.slice(-t)}`;return`${a}`})(e)),a=e.length-3,n=`One or more files can't be submitted: ${t.join(", ")}`;return a>0&&(n+=`, and ${a} more`),`${n}. Only supported file types are allowed.`}(t.files):t.base.startsWith("The size of the space exceeds the current limit")?"The size of the space exceeds the current limit":t.base),z(e)}finally{B(!1)}};(0,u.useEffect)(()=>{z(null)},[O]);let el=es?ei?`${S.currentResourceCount+Q} / ${S.maxResourceCount} possible sources selected, add fewer files.`:`Up to ${I} items can be added at a time.`:V,ec=es||!!V;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(f.X1,{selectionVariant:"instant",open:!k&&P,onOpenChange:e=>{J.current||(M(e),t())},selectedRepoIds:new Set,onSelectRepo:async e=>{e&&(D([]),(0,ee.BI)("copilot-spaces.click",{target:"SELECTED_REPO_FROM_REPO_PICKER"}),await et(e))},cancelReturnFocusRef:p,submitReturnFocusRef:p,error:A??void 0,ownerDisplayLogin:g,includeForks:!0}),k&&(0,n.jsx)(i.l,{onClose:t,title:`Add files from ${k.ownerLogin}/${k.name}`,width:"large",position:{narrow:"fullscreen"},renderHeader:({onClose:e,dialogLabelId:t})=>(0,n.jsxs)(i.l.Header,{children:[(0,n.jsx)("div",{className:Y.dialogHeader,children:(0,n.jsx)(i.l.Title,{id:t,children:(0,n.jsxs)(s.B,{align:"center",direction:"horizontal",gap:"none",children:[!w&&(0,n.jsx)(s.B.Item,{children:(0,n.jsx)(r.K,{icon:d.ArrowLeftIcon,"aria-label":"Back",onClick:ea,variant:"invisible"})}),(0,n.jsxs)(s.B.Item,{grow:!0,className:"mx-1",children:["Select folders and files in ",k.ownerLogin,"/",k.name]}),(0,n.jsx)(s.B.Item,{children:(0,n.jsx)(er,{onClose:()=>e("close-button")})})]})})}),(0,n.jsx)(i.l.Subtitle,{className:"mt-0",children:(0,n.jsx)(y.d,{repository:k,children:(0,n.jsx)(x.Ck,{children:(0,n.jsx)(v.qV,{refInfo:{name:k.refInfo.name,canEdit:!0,listCacheKey:"anything",currentOid:k.commitOID},path:"test",action:"tree",copilotAccessAllowed:!0,children:(0,n.jsx)(C.$,{allShortcutsEnabled:!1,children:(0,n.jsx)(H,{commitOid:k.commitOID,findFileWorkerPath:h,onItemSelected:e=>{e&&W(e)},config:{enableOverlay:!0,disableNavigation:!0,searchPlaceholder:"Search for files or folders",actionText:"Search for files or folders"}})})})})})})]}),renderFooter:()=>(0,n.jsx)(i.l.Footer,{children:(0,n.jsxs)("div",{className:"d-flex flex-justify-between flex-items-center width-full",children:[(0,n.jsx)("div",{className:"d-flex flex-items-center",children:el&&(0,n.jsx)(o.A.Validation,{variant:"error",children:el})}),(0,n.jsxs)("div",{className:"d-flex flex-row flex-justify-end gap-2",children:[(0,n.jsx)(l.Q,{onClick:t,children:"Cancel"}),(0,n.jsx)(l.Q,{...(0,_.G)("save-resource-button"),variant:"primary",onClick:eo,count:F?void 0:(ei?Q:K)||void 0,loading:F,disabled:ec,children:"Add"})]})]})}),renderBody:()=>(0,n.jsxs)("div",{className:"d-flex flex-column",children:[A&&(0,n.jsx)("span",{children:A}),$&&(0,n.jsx)("div",{className:"position-sticky top-0 bgColor-default flash-banner",children:(0,n.jsx)(c.A,{full:!0,variant:"danger",children:(0,n.jsx)(X.JR,{as:"span",html:$})})}),(0,n.jsx)(y.d,{repository:k,children:(0,n.jsx)(x.Ck,{children:(0,n.jsx)(v.qV,{refInfo:{name:k.refInfo.name,canEdit:!0,listCacheKey:"anything",currentOid:k.commitOID},path:"test",action:"tree",copilotAccessAllowed:!0,children:(0,n.jsx)(en,{expandedPath:U,currentRepo:k,localFormData:O,setLocalFormData:D,onFileCountChange:Z,onDisplayCountChange:G,fetchError:A,resourceCounts:S,allowFolderReferences:N,maxFileCount:I,onRejectionMessage:q})})})})]}),className:Y.Dialog})]})}try{en.displayName||(en.displayName="FilePickerForm")}catch{}try{er.displayName||(er.displayName="CloseButton")}catch{}try{ei.displayName||(ei.displayName="MultiFilePicker")}catch{}},79216:(e,t,a)=>{a.d(t,{Q:()=>s});let n=/^@(?[\w-.]+\/[\w-.]+)(?:\/(?\w+)\/(?.+))?$/,r=/^@(?[a-zA-Z0-9_.-]+)$/,i={fromUrlType(e){switch(e){case"issues":return"issue";case"pull":return"pull-request";case"discussions":return"discussion";case"blob":case"tree":return"file";case void 0:return"repository"}},fromMentionType(e){switch(e){case"issues":return"issue";case"pull":return"pull-request";case"discussions":return"discussion";case"files":return"file";case void 0:return"repository"}}},s={fromUrl(e){let t;try{t=new URL(e)}catch{return}if(t.hostname!==window.location.hostname)return;let[,a,n,r,...s]=t.pathname.split("/"),o=s.join("/"),l=i.fromUrlType(r);if(a&&n&&l)return{repo:`${a}/${n}`,type:o?l:"repository",id:o}},stringify(e){switch(e.type){case"issue":return`@${e.repo}/issues/${e.id??""}`;case"pull-request":return`@${e.repo}/pull/${e.id??""}`;case"discussion":return`@${e.repo}/discussions/${e.id??""}`;case"repository":return`@${e.repo}`;case"file":return`@${e.repo}/files/${e.id??""}`;case"thread-scoped-file":return`@${e.id??""}`}},parse(e){let t=n.exec(e)?.groups;if(!t){let t=r.exec(e)?.groups;return t?{repo:"",type:"thread-scoped-file",id:t.id}:void 0}let a=i.fromMentionType(t.type);return a?{repo:t.repo,type:a,id:t.id}:void 0},isEqual:(e,t)=>s.stringify(e)===s.stringify(t),refersTo(e,t){let a=s.for(t);return null!==a&&s.isEqual(e,a)},for:e=>{switch(e.type){case"repository":return{type:"repository",repo:`${e.ownerLogin}/${e.name}`,reference:e};case"issue":return{type:"issue",repo:`${e.repository.owner}/${e.repository.name}`,id:e.number.toString(),reference:e};case"pull-request":return{type:"pull-request",repo:`${e.repository.ownerLogin}/${e.repository.name}`,id:e.number.toString(),reference:e};case"discussion":return{type:"discussion",repo:`${e.repository.owner}/${e.repository.name}`,id:e.number.toString(),reference:e};case"file":case"folder":return{type:"file",repo:`${e.repoOwner}/${e.repoName}`,id:e.path,reference:e};case"thread-scoped-file":return{type:"thread-scoped-file",repo:"",id:e.name,reference:e};default:return null}}}},81829:(e,t,a)=>{a.d(t,{A:()=>m});var n=a(74848),r=a(21728),i=a(71315),s=a(69726),o=a(96540);function l(e){e.preventDefault(),e.stopPropagation()}function c(e){return e instanceof DragEvent}let d=e=>{let t,a,i,s,o,l,c,d,u,m,h,p,g,f,y,x,v=(0,r.c)(17);return v[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsx)("path",{fill:"var(--bgColor-default)",fillRule:"evenodd",d:"M56.66 10.322v.002l16.824 7.846L92.44 70.254a8.75 8.75 0 0 1-5.23 11.217l-37.009 13.47a8.75 8.75 0 0 1-11.217-5.23L18.531 33.512a8.75 8.75 0 0 1 5.23-11.217z",clipRule:"evenodd"}),a=(0,n.jsx)("path",{fill:"var(--bgColor-open-muted)",fillRule:"evenodd",d:"M56.66 10.322v.002l16.824 7.846L92.44 70.254a8.75 8.75 0 0 1-5.23 11.217l-37.009 13.47a8.75 8.75 0 0 1-11.217-5.23L18.531 33.512a8.75 8.75 0 0 1 5.23-11.217z",clipRule:"evenodd"}),i=(0,n.jsx)("path",{fill:"var(--bgColor-open-emphasis)",fillRule:"evenodd",d:"m55.29 10.822.802-.293a1.46 1.46 0 0 1 1.116.049l15.73 7.335c.35.163.62.459.753.822l.294.804 18.458 50.715a8.75 8.75 0 0 1-5.23 11.217l-37.008 13.47a8.75 8.75 0 0 1-11.218-5.23L18.533 33.512a8.75 8.75 0 0 1 5.231-11.217zm.997 2.74L24.762 25.038a5.835 5.835 0 0 0-3.487 7.478l20.454 56.198a5.835 5.835 0 0 0 7.478 3.487l37.008-13.47a5.835 5.835 0 0 0 3.487-7.478L71.243 20.537l-5.482 1.996a5.82 5.82 0 0 1-4.461-.195 5.82 5.82 0 0 1-3.017-3.293z",clipRule:"evenodd",opacity:"0.12"}),v[0]=t,v[1]=a,v[2]=i):(t=v[0],a=v[1],i=v[2]),v[3]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsx)("g",{clipPath:"url(#clip0_12526_110155)",children:(0,n.jsx)("path",{fill:"var(--bgColor-open-emphasis)",fillRule:"evenodd",d:"M64.035 44.691c-.703 2.448-1.974 5.334-3.06 7.703-.93 2.029-1.94 3.575-2.932 4.66a5.46 5.46 0 0 1 .165 4.949c-.376.806-1.116 1.478-1.841 2.006-.754.549-1.631 1.04-2.446 1.445a31 31 0 0 1-3.066 1.318l-.053.02-.015.004-.004.002h-.002a1.095 1.095 0 0 1-1.388-.647v-.002l-.002-.004-.006-.015-.02-.053-.07-.196a30.973 30.973 0 0 1-.89-2.999c-.214-.885-.402-1.872-.466-2.803-.062-.895-.022-1.894.354-2.7a5.46 5.46 0 0 1 3.883-3.052c.178-1.474.697-3.268 1.635-5.314 1.092-2.383 2.494-5.198 3.94-7.294.718-1.039 1.498-1.978 2.313-2.587.804-.603 1.896-1.056 3.022-.53 1.134.53 1.46 1.673 1.497 2.667.037 1.011-.2 2.208-.548 3.422m-9.653 9.647a5.5 5.5 0 0 1 2.228 1.035c.515-.598 1.067-1.388 1.623-2.394l-3.1-1.445c-.397 1.08-.635 2.02-.751 2.804m7.55-10.25c-.61 2.121-1.702 4.662-2.733 6.928l-3.212-1.498c1.049-2.259 2.309-4.736 3.565-6.556.672-.973 1.292-1.682 1.823-2.08.541-.404.74-.318.783-.297h.003c.026.012.21.096.235.764.024.663-.136 1.594-.464 2.739m-8.986 19.408c-.682.34-1.342.627-1.862.84a29 29 0 0 1-.553-1.966c-.198-.823-.357-1.68-.41-2.441-.054-.796.02-1.336.155-1.625a3.282 3.282 0 1 1 5.949 2.774c-.135.29-.5.693-1.146 1.162-.617.45-1.375.878-2.133 1.256",clipRule:"evenodd"})}),o=(0,n.jsx)("path",{fill:"var(--bgColor-default)",fillRule:"evenodd",d:"M198.941 19.499 166.042 7.525a8.75 8.75 0 0 0-11.217 5.23L134.37 68.953a8.75 8.75 0 0 0 5.231 11.217l37.008 13.47a8.75 8.75 0 0 0 11.217-5.231l18.959-52.089z",clipRule:"evenodd"}),l=(0,n.jsx)("path",{fill:"var(--bgColor-sponsors-muted)",fillRule:"evenodd",d:"M198.941 19.499 166.042 7.525a8.75 8.75 0 0 0-11.217 5.23L134.37 68.953a8.75 8.75 0 0 0 5.231 11.217l37.008 13.47a8.75 8.75 0 0 0 11.217-5.231l18.959-52.089z",clipRule:"evenodd"}),c=(0,n.jsx)("path",{fill:"var(--bgColor-sponsors-emphasis)",fillRule:"evenodd",d:"m197.568 19.003.803.292c.363.132.659.404.823.754l7.335 15.73c.163.35.181.751.049 1.114l-.293.805-18.458 50.715a8.75 8.75 0 0 1-11.217 5.23l-37.008-13.47a8.75 8.75 0 0 1-5.231-11.217l20.454-56.197a8.75 8.75 0 0 1 11.217-5.23zm-.998 2.741L165.045 10.27a5.836 5.836 0 0 0-7.479 3.487l-20.454 56.197a5.834 5.834 0 0 0 3.487 7.478l37.008 13.47a5.836 5.836 0 0 0 7.479-3.487L203.544 36.7l-5.483-1.995a5.82 5.82 0 0 1-3.292-3.017 5.82 5.82 0 0 1-.195-4.461z",clipRule:"evenodd",opacity:"0.12"}),v[3]=s,v[4]=o,v[5]=l,v[6]=c):(s=v[3],o=v[4],l=v[5],c=v[6]),v[7]===Symbol.for("react.memo_cache_sentinel")?(u=(0,n.jsx)("g",{clipPath:"url(#clip1_12526_110155)",children:(0,n.jsx)("path",{fill:"var(--bgColor-sponsors-emphasis)",fillRule:"evenodd",d:"M179.168 44.01a2.553 2.553 0 0 1 3.393 1.235l.946 2.03a2.55 2.55 0 0 1-1.235 3.392l-16.096 7.506a2.55 2.55 0 0 1-1.259.232l-4.919-.348a1.094 1.094 0 0 1-.808-1.734l2.894-3.992c.255-.351.595-.632.988-.815zm1.41 2.16a.365.365 0 0 0-.485-.177l-2.36 1.1 1.254 2.692 2.361-1.101a.365.365 0 0 0 .176-.485zm-3.574 4.54-1.254-2.692-11.753 5.48a.36.36 0 0 0-.141.117l-1.739 2.399 2.955.209a.36.36 0 0 0 .18-.033z",clipRule:"evenodd"})}),m=(0,n.jsx)("path",{fill:"var(--bgColor-default)",fillRule:"evenodd",d:"M128.059 0H93.052A8.75 8.75 0 0 0 84.3 8.752v59.804a8.75 8.75 0 0 0 8.752 8.751h39.383a8.75 8.75 0 0 0 8.751-8.751v-55.43z",clipRule:"evenodd"}),h=(0,n.jsx)("path",{fill:"var(--bgColor-accent-muted)",fillRule:"evenodd",d:"M128.059 0H93.052A8.75 8.75 0 0 0 84.3 8.752v59.804a8.75 8.75 0 0 0 8.752 8.751h39.383a8.75 8.75 0 0 0 8.751-8.751v-55.43z",clipRule:"evenodd"}),d=(0,n.jsx)("path",{fill:"var(--bgColor-accent-emphasis)",fillRule:"evenodd",d:"M126.6 0h.855c.386 0 .757.154 1.031.427L140.758 12.7c.274.273.427.644.428 1.03v54.826a8.75 8.75 0 0 1-8.751 8.751H93.052a8.75 8.75 0 0 1-8.752-8.751V8.752A8.75 8.75 0 0 1 93.052 0zm0 2.917H93.052a5.835 5.835 0 0 0-5.835 5.835v59.804a5.835 5.835 0 0 0 5.835 5.834h39.383a5.834 5.834 0 0 0 5.834-5.834v-53.97h-5.834a5.82 5.82 0 0 1-4.126-1.709 5.82 5.82 0 0 1-1.709-4.125z",clipRule:"evenodd",opacity:"0.12"}),v[7]=d,v[8]=u,v[9]=m,v[10]=h):(d=v[7],u=v[8],m=v[9],h=v[10]),v[11]===Symbol.for("react.memo_cache_sentinel")?(p=(0,n.jsx)("g",{clipPath:"url(#clip2_12526_110155)",children:(0,n.jsx)("path",{fill:"var(--bgColor-accent-emphasis)",fillRule:"evenodd",d:"M104.354 31.356a.364.364 0 0 0-.364.365v15.315c0 .202.163.365.364.365h1.373l.042-.045 8.864-8.864c.962-.962 2.509-1 3.518-.088l4.801 4.344V31.72a.365.365 0 0 0-.365-.365zM122.587 47.4h-13.768l7.361-7.362a.365.365 0 0 1 .503-.013l6.269 5.672v1.338a.365.365 0 0 1-.365.365m2.553-.365V31.721a2.553 2.553 0 0 0-2.553-2.553h-18.233a2.553 2.553 0 0 0-2.552 2.553v15.315a2.553 2.553 0 0 0 2.552 2.553h18.233a2.553 2.553 0 0 0 2.553-2.553m-15.316-10.575a.729.729 0 1 1-1.458 0 .729.729 0 0 1 1.458 0m2.188 0a2.917 2.917 0 1 1-5.834 0 2.917 2.917 0 0 1 5.834 0",clipRule:"evenodd"})}),v[11]=p):p=v[11],v[12]===Symbol.for("react.memo_cache_sentinel")?(g=(0,n.jsx)("clipPath",{id:"clip0_12526_110155",children:(0,n.jsx)("path",{fill:"var(--bgColor-default)",d:"m41.466 45.344 21.93-7.982 7.982 21.93-21.93 7.982z"})}),v[12]=g):g=v[12],v[13]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsx)("clipPath",{id:"clip1_12526_110155",children:(0,n.jsx)("path",{fill:"var(--bgColor-default)",d:"m164.786 36.563 21.93 7.982-7.982 21.93-21.93-7.982z"})}),v[13]=f):f=v[13],v[14]===Symbol.for("react.memo_cache_sentinel")?(y=(0,n.jsxs)("defs",{children:[g,f,(0,n.jsx)("clipPath",{id:"clip2_12526_110155",children:(0,n.jsx)("path",{fill:"var(--bgColor-default)",d:"M101.802 27.71h23.338V51.05h-23.338z"})})]}),v[14]=y):y=v[14],v[15]!==e?(x=(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"226",height:"103",fill:"none",viewBox:"0 0 226 103",...e,children:[t,a,i,s,o,l,c,u,m,h,d,p,y]}),v[15]=e,v[16]=x):x=v[16],x};try{d.displayName||(d.displayName="DragAndDropSVG")}catch{}let u={overlay:"FullScreenDragOverlay-module__overlay--Q9gow",centeredContent:"FullScreenDragOverlay-module__centeredContent--iAFMy",text:"FullScreenDragOverlay-module__text--oftCM"};function m(e){let t,a,m,h=(0,r.c)(9),{onFilesDrop:p,isUploading:g}=e,f=void 0!==g&&g;h[0]!==f||h[1]!==p?(t=e=>{f||p(e)},h[0]=f,h[1]=p,h[2]=t):t=h[2];let y=t;h[3]!==y?(a={onFilesDrop:y,targetElement:i.XC},h[3]=y,h[4]=a):a=h[4];let{isDragging:x}=function(e){let t,a,n,i=(0,r.c)(6),{onFilesDrop:s,targetElement:d}=e,[u,m]=(0,o.useState)(!1),h=(0,o.useRef)(0);return i[0]!==s||i[1]!==d?(t=()=>{if(!d)return;let e=e=>{c(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer?.types.includes("Files")&&(h.current=h.current+1,1===h.current&&m(!0)))},t=e=>{e.preventDefault(),e.stopPropagation(),h.current=h.current-1,h.current<=0&&(h.current=0,m(!1))},a=e=>{if(!c(e))return;e.preventDefault(),e.stopPropagation(),h.current=0,m(!1);let t=e.dataTransfer?.files;t&&0!==t.length&&s(t)};return d.addEventListener("dragover",l),d.addEventListener("dragenter",e),d.addEventListener("dragleave",t),d.addEventListener("drop",a),()=>{d.removeEventListener("dragover",l),d.removeEventListener("dragenter",e),d.removeEventListener("dragleave",t),d.removeEventListener("drop",a)}},a=[s,d],i[0]=s,i[1]=d,i[2]=t,i[3]=a):(t=i[2],a=i[3]),(0,o.useEffect)(t,a),i[4]!==u?(n={isDragging:u},i[4]=u,i[5]=n):n=i[5],n}(a),v=null;if(f){let e;h[5]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.A,{size:"large"}),(0,n.jsx)("p",{className:u.text,children:"Uploading files..."})]}),h[5]=e):e=h[5],v=e}else if(x){let e;h[6]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d,{}),(0,n.jsx)("p",{className:u.text,children:"Drop files to upload"})]}),h[6]=e):e=h[6],v=e}return v?(h[7]!==v?(m=(0,n.jsx)("div",{className:u.overlay,children:(0,n.jsx)("div",{className:u.centeredContent,children:v})}),h[7]=v,h[8]=m):m=h[8],m):null}try{m.displayName||(m.displayName="FullScreenDragOverlay")}catch{}},82591:(e,t,a)=>{a.d(t,{z:()=>n});let n=Object.freeze({INITIAL:"soft-nav:initial",START:"soft-nav:start",REPLACE_MECHANISM:"soft-nav:replace-mechanism",SUCCESS:"soft-nav:success",ERROR:"soft-nav:error",FRAME_UPDATE:"soft-nav:frame-update",END:"soft-nav:end",RENDER:"soft-nav:render",PROGRESS_BAR:{START:"soft-nav:progress-bar:start",END:"soft-nav:progress-bar:end"}})},82595:(e,t,a)=>{a.d(t,{I:()=>d});var n=a(74848),r=a(21728),i=a(34164),s=a(49851),o=a(38621);let l={container:"Icon-module__container--stxcA",customColor:"Icon-module__customColor--dELU9",hasBackground:"Icon-module__hasBackground--xipmb",auburn:"Icon-module__auburn--YGPGc",blue:"Icon-module__blue--YHcrq",brown:"Icon-module__brown--HcCTh",coral:"Icon-module__coral--oTikb",cyan:"Icon-module__cyan--h419p",gray:"Icon-module__gray--VfK1C",green:"Icon-module__green--DZFaM",indigo:"Icon-module__indigo--VVAUE",lemon:"Icon-module__lemon--pOsfR",lime:"Icon-module__lime--qwkv8",olive:"Icon-module__olive--UDJGA",orange:"Icon-module__orange--Zpvu1",pine:"Icon-module__pine--w0tcb",pink:"Icon-module__pink--ai8ga",plum:"Icon-module__plum--IYN4u",purple:"Icon-module__purple--rFSpj",red:"Icon-module__red--OLgIH",teal:"Icon-module__teal--eysuL",yellow:"Icon-module__yellow--UE4Kb"},c=new Set(Object.keys(l).filter(e=>!["container","hasBackground","customColor"].includes(e)));function d(e){let t,a,d,u,m,h,p=(0,r.c)(19),{icon:g,hasBackground:f,color:y,size:x,className:v}=e,C=void 0!==f&&f,_=void 0===y?"gray":y,S=void 0===x?16:x;if("string"==typeof g)if(g in s.OZ)t=s.OZ[g];else{let e;p[0]!==g?(e=function(e){let t=`${e.replaceAll(/(?:^|-)(\w)/g,(e,t)=>t.toUpperCase())}Icon`;return t in o?o[t]:void 0}(g),p[0]=g,p[1]=e):e=p[1],t=e}else t=g;if(!t)return null;p[2]!==_?(a=c.has(_),p[2]=_,p[3]=a):a=p[3];let b=a,j=`${C?2*S:S}px`;p[4]!==_||p[5]!==b||p[6]!==j?(d={"--custom-size":j},b||(d["--custom-color"]=_),p[4]=_,p[5]=b,p[6]=j,p[7]=d):d=p[7];let w=b?l[_]:l.customColor,N=C&&l.hasBackground;return p[8]!==v||p[9]!==w||p[10]!==N?(u=(0,i.$)(l.container,w,N,v),p[8]=v,p[9]=w,p[10]=N,p[11]=u):u=p[11],p[12]!==t||p[13]!==S?(m=(0,n.jsx)(t,{size:S,fill:"currentColor"}),p[12]=t,p[13]=S,p[14]=m):m=p[14],p[15]!==d||p[16]!==u||p[17]!==m?(h=(0,n.jsx)("div",{style:d,className:u,children:m}),p[15]=d,p[16]=u,p[17]=m,p[18]=h):h=p[18],h}try{d.displayName||(d.displayName="Icon")}catch{}},84331:(e,t,a)=>{function n(e,t,a=.1){let r=s(e,t,a);return r&&-1===t.indexOf("/")&&(r+=s(e.substring(e.lastIndexOf("/")+1),t,a)),r}function r(e,t,a){if(t){let n=e.innerHTML.trim().match(a||function(e){let t=e.toLowerCase().split(""),a="",n=!0;for(let e of t){let t=e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&");n?(a+=`(.*)(${t})`,n=!1):a+=`([^${t}]*?)(${t})`}return RegExp(`${a}(.*?)$`,"i")}(t));if(!n)return;let r=!1,i=[];for(let e=1;e"),r=!0):r&&(i.push(""),r=!1),i.push(t))}e.innerHTML=i.join("")}else{let t=e.innerHTML.trim(),a=t.replace(/<\/?mark>/g,"");t!==a&&(e.innerHTML=a)}}a.d(t,{He:()=>r,UD:()=>o,dt:()=>n});let i=new Set([" ","-","_"]);function s(e,t,a=.1){let n=e;if(n===t)return 1;let r=n.length,o=0,l=0,c=!0;for(let e of t){let t=n.indexOf(e.toLowerCase()),s=n.indexOf(e.toUpperCase()),d=Math.min(t,s),u=d>-1?d:Math.max(t,s);if(-1===u)return 0;o+=.1,n[u]===e&&(o+=.1),0===u&&(o+=.9-a,c&&(l=1)),i.has(n.charAt(u-1))&&(o+=.9-a),n=n.substring(u+1,r),c=!1}let d=t.length,u=o/d,m=(d/r*u+u)/2;return l&&m+a<1&&(m+=a),m}function o(e,t){return e.score>t.score?-1:e.scoret.text)}},84646:(e,t,a)=>{a.d(t,{$7:()=>h,$W:()=>C,AV:()=>v,Ao:()=>f,BV:()=>x,OW:()=>CopilotSpaceSSOError,Tx:()=>y,e9:()=>p,i9:()=>CopilotSpaceNotFoundError,jS:()=>g});var n=a(50467),r=a(97665),i=a(94747),s=a(97286),o=a(72011),l=a(33592),c=a(96540),d=a(2635),u=a(71315),m=a(23657);let CopilotSpaceNotFoundError=class CopilotSpaceNotFoundError extends Error{constructor(e="Copilot Space not found"){super(e),this.name="CopilotSpaceNotFoundError"}};let CopilotSpaceSSOError=class CopilotSpaceSSOError extends Error{constructor(e,t="Copilot Space SSO error"){super(t),(0,n._)(this,"protectedOrganizations",void 0),this.protectedOrganizations=e,this.name="CopilotSpaceSSOError"}};function h(){let e=(0,r.jE)(),t=(0,l.b)();return(0,i.n)({mutationFn:async e=>{let a=await (0,o.ee)(e);if(!a.ok)throw Error(a.error);return t.dispatch({type:"REMOVE_CUSTOM_COPILOT",customCopilotId:e}),{status:a.status,ok:!0,payload:a.payload}},onSuccess:async()=>{await e.invalidateQueries({queryKey:o.O6})}})}function p(e){let t=(0,l.b)(),{data:a}=g(e,{throwOnError:!1});(0,c.useEffect)(()=>{a&&t.dispatch({type:"SET_CUSTOM_COPILOTS",customCopilots:a})},[a,t])}function g(e,t={}){return(0,s.I)({queryKey:o.O6,queryFn:o.CT,enabled:e,staleTime:3e5,throwOnError:t.throwOnError})}function f(e){return(0,s.I)({queryKey:(0,o.dp)(e),queryFn:async()=>{let t=await (0,o.Lr)(e);if(!t.ok){if(404===t.status)throw new CopilotSpaceNotFoundError;throw Error(t.error)}if(void 0===t.payload.id)throw new CopilotSpaceSSOError(t.payload.protectedOrganizations);return t.payload},enabled:!!e})}function y(e,t){return(0,s.I)({queryKey:["visibility-settings",e,t],queryFn:async()=>(0,o.A2)({owner:e,id:t}),enabled:""!==e&&-1!==t,staleTime:3e5})}function x(){return(0,d.A3)("customCopilotsEnabled")}function v(){let e=function(){let e=(0,d.A3)("customCopilots");return e?.length??0}();return(0,c.useMemo)(()=>`New Space ${e+1}`,[e])}function C(e){return(0,c.useMemo)(()=>{if(!e)return;let{owner:t}=e,a=u.cg?.location.origin;if(!a)return;let n=(0,m.Cb)(e),r=`${a}${n}`,i=`content_url=${encodeURIComponent(r)}&report=${t}+(user)`;return`${a}/contact/report-content?${i}`},[e])}},87419:(e,t,a)=>{a.d(t,{Y:()=>d});var n=a(21728),r=a(96540),i=a(25641),s=a(79064),o=a(2635),l=a(33592),c=a(72303);function d(e){let t,a,d,u,m,h,p,g,f,y,x=(0,n.c)(26),v=(0,o.Pk)(),C=(0,l.b)(),{currentTopic:_,messages:S,selectedThreadID:b}=v;x[0]!==v?(t=(0,c.W)(v),x[0]=v,x[1]=t):t=x[1];let j=t,w=(0,r.useRef)(null),N=e||w;return x[2]!==C||x[3]!==S.length||x[4]!==j?(a=()=>{j&&S.length>0&&C.showTopicPicker(!1)},d=[j,S.length,C],x[2]=C,x[3]=S.length,x[4]=j,x[5]=a,x[6]=d):(a=x[5],d=x[6]),(0,r.useEffect)(a,d),x[7]!==_||x[8]!==b?(u=()=>{let e=_?(0,i.P)(_)?_.name:String(_.id):null;b&&e&&s.Jt.setSelectedTopic(b,e)},m=[b,_],x[7]=_,x[8]=b,x[9]=u,x[10]=m):(u=x[9],m=x[10]),(0,r.useEffect)(u,m),x[11]!==N?(h=()=>{let e=window.setTimeout(()=>{N.current?.focus()},1);return()=>{window.clearTimeout(e)}},p=[N],x[11]=N,x[12]=h,x[13]=p):(h=x[12],p=x[13]),(0,r.useEffect)(h,p),x[14]!==C||x[15]!==v.context?.[0]||x[16]!==v.currentRepository?(g=()=>{let e=v.context?.[0]??v.currentRepository;return e&&C.generateSuggestions(e),()=>{C.clearSuggestions()}},x[14]=C,x[15]=v.context?.[0],x[16]=v.currentRepository,x[17]=g):g=x[17],x[18]!==C||x[19]!==v.context||x[20]!==v.currentRepository||x[21]!==v.currentTopic||x[22]!==v.selectedThreadID?(f=[C,v.context,v.currentTopic,v.currentRepository,v.selectedThreadID],x[18]=C,x[19]=v.context,x[20]=v.currentRepository,x[21]=v.currentTopic,x[22]=v.selectedThreadID,x[23]=f):f=x[23],(0,r.useEffect)(g,f),x[24]!==N?(y={textAreaRef:N},x[24]=N,x[25]=y):y=x[25],y}},88431:(e,t,a)=>{a.d(t,{N:()=>i});var n=a(71315),r=a(96540);let i=void 0!==n.cg?.document?.createElement?r.useLayoutEffect:r.useEffect},91474:(e,t,a)=>{a.d(t,{j:()=>o});var n=a(21728),r=a(38621),i=a(47789),s=a(35247);function o(e){let t,a,o,m=(0,n.c)(8),{enabled:h}=e,p=(0,i.qw)();if(m[0]!==h||m[1]!==p){e:{let e=[];if(!h){t=e;break e}for(let t of p)t.slashCommand&&e.push({key:t.slashCommand.key,name:t.slashCommand.name,description:t.slashCommand.description,icon:t.slashCommand.icon,isNew:t.slashCommand.isNew,order:t.slashCommand.order,suggestions:t.slashCommand.suggestions,execute:async(e,a,n)=>await t.slashCommand.execute(e,a,n)});s.W.planningAgent&&e.push({key:"brainstorm",name:"Brainstorm",description:"Create a plan and turn them into tasks",icon:r.TasklistIcon,order:1,suggestions:[],execute:u}),e.push({key:"create-issue",name:"Create issue",description:"Create a GitHub issue from your conversation",icon:r.IssueDraftIcon,suggestions:["First, create a new draft issue. Then ask for additional information to fill out the issue.","First, create an issue with sub issues. Then ask for additional information to fill out these issues."],execute:d}),t=e.sort(c)}m[0]=h,m[1]=p,m[2]=t}else t=m[2];let g=t;return m[3]!==g?(a=g.map(l),m[3]=g,m[4]=a):a=m[4],m[5]!==g||m[6]!==a?(o={availableCommands:g,availableCommandKeys:a},m[5]=g,m[6]=a,m[7]=o):o=m[7],o}function l(e){return e.key}function c(e,t){return void 0!==e.order&&void 0!==t.order?e.order-t.order:void 0!==e.order?-1:void 0!==t.order?1:e.name.localeCompare(t.name)}function d(){return!1}function u(e,t,a,n){return n.setUsePlanningIntent(!0),!1}},97315:(e,t,a)=>{a.d(t,{P:()=>c});var n=a(74848),r=a(21728),i=a(84078),s=a(96540),o=a(33592);let l={ambientErrorBanner:"AmbientErrorBanner-module__ambientErrorBanner--lajPC",largeBorderRadius:"AmbientErrorBanner-module__largeBorderRadius--NGjjE",mediumBorderRadius:"AmbientErrorBanner-module__mediumBorderRadius--aAp6Z"};function c(e){let t,a,c,u,m,h,p=(0,r.c)(14),{ambientError:g,useLargerBorderRadius:f}=e,y=(0,o.b)(),[x,v]=(0,s.useState)(0),C=void 0!==f&&f?l.largeBorderRadius:l.mediumBorderRadius,_=(0,s.useRef)(null);p[0]!==g.message?(t=()=>{if(g.message){v(d);let e=setTimeout(()=>{_.current&&_.current.focus()},250);return()=>clearTimeout(e)}},p[0]=g.message,p[1]=t):t=p[1],p[2]!==g?(a=[g],p[2]=g,p[3]=a):a=p[3],(0,s.useEffect)(t,a);let S=`${l.ambientErrorBanner} ${C}`;return p[4]===Symbol.for("react.memo_cache_sentinel")?(c={outline:"none"},p[4]=c):c=p[4],p[5]!==g.message?(u=(0,n.jsx)("div",{ref:_,tabIndex:-1,style:c,children:g.message}),p[5]=g.message,p[6]=u):u=p[6],p[7]!==y?(m=()=>{y.dismissAmbientError()},p[7]=y,p[8]=m):m=p[8],p[9]!==x||p[10]!==S||p[11]!==u||p[12]!==m?(h=(0,n.jsx)(i.l,{"aria-atomic":"true",className:S,description:u,variant:"critical",title:"Error during copilot chat has occurred.",hideTitle:!0,onDismiss:m},x),p[9]=x,p[10]=S,p[11]=u,p[12]=m,p[13]=h):h=p[13],h}function d(e){return e+1}try{c.displayName||(c.displayName="AmbientErrorBanner")}catch{}},97564:(e,t,a)=>{a.d(t,{V:()=>r});var n=a(96379);async function r(e){let t=await (0,n.lS)(`/github-copilot/chat/repositories/${e}`,{method:"GET"});if(!t.ok)throw Error(`Failed to fetch repository details: ${t.status}`);return await t.json()}},97793:(e,t,a)=>{a.d(t,{O:()=>p});var n=a(74848),r=a(96379),i=a(38621),s=a(15220),o=a(86877),l=a(99511),c=a(43371),d=a.n(c),u=a(96540);let m={dialogForm:"McpServerDialog-module__dialogForm--pUtNF",underline:"McpServerDialog-module__underline--YKUMk",inputError:"McpServerDialog-module__inputError--Ojb_P",formField:"McpServerDialog-module__formField--rsUqW",hiddenSubmitButton:"McpServerDialog-module__hiddenSubmitButton--KcK0s"},h=(0,n.jsx)("a",{href:"https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization",target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"underline"},children:"MCP authorization specification"}),p=({isOpen:e,onClose:t,returnUrl:a,onServerAdded:c,returnFocusRef:p,showSettingsLink:g=!0})=>{let[f,y]=(0,u.useState)(""),[x,v]=(0,u.useState)(""),[C,_]=(0,u.useState)(null),[S,b]=(0,u.useState)(null),j=(0,u.useCallback)(()=>{y(""),v(""),_(null),b(null),t()},[t]),w=async e=>{if(e&&e.preventDefault(),""===f.trim()||""===x.trim()){x.trim()||_("MCP server URL is required"),f.trim()||b("Name is required");return}try{if(_(null),!function(e){try{let t=new URL(e.trim(),window.location.origin),a=d()();return"https:"===t.protocol&&!!t.hostname&&/^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(t.hostname)&&!a.test(e)}catch{return!1}}(x))return void _("Invalid HTTPS URL format");let e=new FormData;e.append("mcp_server_url",x.trim()),e.append("name",f.trim()),a&&e.append("return_url",a);let t=await (0,r.DI)("/copilot/mcp/servers",{method:"POST",body:e});if(!t.ok){let e="Failed to add MCP server";try{let a=await t.text();try{let t=JSON.parse(a);if("unsupported_server_type"===t.error)e=(0,n.jsxs)(n.Fragment,{children:["This server does not conform to the ",h,"."]});else if(t.field_errors){for(let[e,a]of Object.entries(t.field_errors)){let t=a.join(", ");"mcp_server_url"===e?_(t):"display_name"===e&&b(t)}return}else t.message&&(e=t.message)}catch{e=a.includes("well-known/oauth-authorization-server")||"Client setup failed"===a.trim()?(0,n.jsxs)(n.Fragment,{children:["This server does not conform to the ",h,"."]}):a||e}}catch{e="Failed to add MCP server"}_(e);return}let i=(await t.json()).redirect_url;i&&"string"==typeof i?(j(),c?.(),window.location.assign(i)):(j(),c?.())}catch(e){e instanceof Error?_(e.message):_("An unknown error occurred")}};return e?(0,n.jsx)(s.l,{title:"Add MCP server",onClose:j,footerButtons:[{buttonType:"default",content:"Cancel",onClick:j},{buttonType:"primary",content:(0,n.jsxs)(n.Fragment,{children:["Connect to MCP server",(0,n.jsx)("span",{style:{marginLeft:8},children:(0,n.jsx)(i.LinkExternalIcon,{size:16})})]}),onClick:()=>{w()}}],returnFocusRef:p,children:(0,n.jsxs)("form",{className:m.dialogForm,onSubmit:w,autoComplete:"on",children:[(0,n.jsxs)(o.A,{required:!0,className:m.formField,children:[(0,n.jsx)(o.A.Label,{children:"MCP server name"}),(0,n.jsx)(l.A,{name:"mcp-server-name",type:"text",value:f,onChange:e=>{y(e.target.value),b(null)},placeholder:"Enter a name for this MCP server",className:S?m.inputError:void 0,autoComplete:"on",block:!0}),S&&(0,n.jsx)(o.A.Validation,{variant:"error",children:S})]}),(0,n.jsxs)(o.A,{required:!0,className:m.formField,children:[(0,n.jsx)(o.A.Label,{children:"MCP server URL"}),(0,n.jsx)(l.A,{name:"mcp-url",type:"url",value:x,onChange:e=>{v(e.target.value),_(null)},placeholder:"https://mcp.example.com",className:C?m.inputError:void 0,autoComplete:"on",block:!0}),C&&(0,n.jsx)(o.A.Validation,{variant:"error",children:C})]}),(0,n.jsx)("button",{type:"submit",className:m.hiddenSubmitButton,tabIndex:-1,children:"Submit"}),(0,n.jsxs)("p",{children:["MCP Server data will be processed by models coming from third-party providers. Always review the permissions required by the MCP server and only connect to MCP servers you know and trust.",g&&(0,n.jsxs)(n.Fragment,{children:[" ","You can revoke access for the MCP server at any time in"," ",(0,n.jsx)("a",{href:"/settings",className:m.underline,children:"your settings"}),"."]})]})]})}):null};try{h.displayName||(h.displayName="MCP_SPEC_LINK")}catch{}try{p.displayName||(p.displayName="McpServerDialog")}catch{}},97949:(e,t,a)=>{a.d(t,{U:()=>l});var n=a(99054),r=a(17925),i=a(25641),s=a(35247),o=a(79216);let l=function({references:e,agents:t,commands:a}){this.parser=function(l){let c=l.split(/(\s+)/),d=[];for(let[l,u]of c.entries()){if(s.W.chatInputCommands&&0===l){let e=(0,r.V)(u,a);if(e){d.push({type:"command",value:u,data:{command:e}});continue}}let c=0===l&&n.qj.exec(u)?.groups?.slug,m=c&&t.find(e=>e.slug===c);if(m){d.push({type:"agent-mention",value:u,data:{mentionedAgent:m}});continue}let h=o.Q.parse(u),p=h&&e?.find(e=>o.Q.refersTo(h,e));if(h){d.push({type:"reference-mention",value:u,data:{mentionedReferenceId:p&&(0,i.Vb)(p),referenceMention:h}});continue}let g=d.at(-1);g?.type==="text"?g.value+=u:d.push({type:"text",value:u})}return{type:"root",children:d}}}},99054:(e,t,a)=>{a.d(t,{JE:()=>p,Z3:()=>m,bn:()=>u,kw:()=>g,qj:()=>h});var n=a(21728),r=a(97286),i=a(8625),s=a(14521),o=a(25641),l=a(2635),c=a(33592),d=a(72206);let u="https://github.com/marketplace?type=apps&copilot_app=true",m="@",h=/^@(?\S+)$/;function p(e){let t,a,i,u,m,h,p=(0,n.c)(25),{agentsPath:g,model:f}=(0,l.bP)("agentsPath","model"),y=(0,d.tD)(),x=(0,c.b)(),v=!!(0,s.G)(),C=f?.hasLimitedCapabilities;p[0]!==y||p[1]!==v||p[2]!==C?(t=e=>{let{messages:t}=y();if(C||v)return{agents:[],showLimit:!1};let a=(0,o.Q7)(t)[0];return a?{agents:e.filter(e=>e.slug===a.name),showLimit:e.length>1}:{agents:e,showLimit:!1}},p[0]=y,p[1]=v,p[2]=C,p[3]=t):t=p[3];let _=t;p[4]!==g?(a=["copilot-chat","agents",g],p[4]=g,p[5]=a):a=p[5],p[6]!==g||p[7]!==x?(i=()=>g?x.fetchAgents(g):[],p[6]=g,p[7]=x,p[8]=i):i=p[8];let S=(void 0===e||e)&&!C&&!v;p[9]!==_||p[10]!==a||p[11]!==i||p[12]!==S?(u={queryKey:a,queryFn:i,select:_,enabled:S},p[9]=_,p[10]=a,p[11]=i,p[12]=S,p[13]=u):u=p[13];let{isLoading:b,data:j,refetch:w,isStale:N,isFetched:I}=(0,r.I)(u);p[14]!==j||p[15]!==I||p[16]!==N||p[17]!==w?(m=async()=>!I||N?(await w()).data:j,p[14]=j,p[15]=I,p[16]=N,p[17]=w,p[18]=m):m=p[18];let E=m,T=j?.agents,A=j?.showLimit??!1;return p[19]!==E||p[20]!==b||p[21]!==T||p[22]!==A||p[23]!==C?(h={loading:b,disabled:C,availableAgents:T,showLimit:A,imperativelyFetch:E},p[19]=E,p[20]=b,p[21]=T,p[22]=A,p[23]=C,p[24]=h):h=p[24],h}function g(e){let t,a,r=(0,n.c)(6),{inputOnChange:s,inputRef:o}=e;r[0]!==s||r[1]!==o?(t={inputRef:o,fallbackEventHandler:s},r[0]=s,r[1]=o,r[2]=t):t=r[2];let l=(0,i.H)(t);return r[3]!==l||r[4]!==o?(a=e=>{o.current?.value&&l(" ",[0,0]);let t=`${m}${void 0===e?"":e}`;l(t,[0,0],t.length)},r[3]=l,r[4]=o,r[5]=a):a=r[5],a}}}]); //# sourceMappingURL=packages_noop_noop_ts-packages_promise-with-resolvers-polyfill_promise-with-resolvers-polyfil-c8aad9-55d51da84c04.js.map